2016年8月

GIT/NPM/BOWSER的代理设置等

npm

  1. 设置全局使用指定的镜像
alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"

npm config set registry http://mirrors.jd.com/npm/
  1. 使用代理
npm config set proxy=http://localhost:7070
npm config set https-proxy=http://localhost:7070
npm config set strict-ssl false

npm config delete proxy
npm config delete https-proxy
npm config set strict-ssl true

git

git config --global url.https://.insteadOf git://
git config --global http.proxy http://localhost:7070
git config --global https.proxy http://localhost:7070

git config --global --unset http.proxy
git config --global --unset https.proxy

bower

modify .bowerrc file

{
    "proxy": "http://localhost:7070",
    "https-proxy": "http://localhost:7070",
    "strict-ssl": false
}

chromerdriver error

npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver -g

windows 设置镜像

# C:\Program Files\nodejs\node_modules\npm\npmrc

prefix=D:\.npm\node_global
cache=D:\.npm\node_cache
registry=https://registry.npm.taobao.org

上述操作后注意把prefix加入环境变量PATH中

NODE_GLOBAL=D:\.npm\node_global
PATH=...;%NODE_GLOBAL%

查看安装了哪些全局包

npm -g list

查看npm install 详情

npm install --verbose
npm install -ddd

npm on cygwin

https://github.com/emigenix/npm_on_cygwin

GIT的证书问题

git clone时,出现如下错误

SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

因为git使用curl来进行,开启CURL VERBOSE选项调试,发现是证书没找到

export GIT_CURL_VERBOSE=1

curl_7.18.0以后版本自带了证书,但旧版本需要从网站上down来安装

curl http://curl.haxx.se/ca/cacert.pem -o cacert.pem
git config --global http.sslCAInfo /home/whtest/etc/https-ca/cacert.pem

再次执行git-clone发现问题解决

无ROOT权限LAMP

如题,因此只能从源码安装MySQL

安装ncurses

从 http://ftp.gnu.org/pub/gnu/ncurses/ 下载合适版本
可以yum info nurses来看看当前系统兼容哪个版本

./configure --prefix=/home/whtest/usr/local/ncurses --with-shared
make && make install

安装mysql-server

从 http://downloads.mysql.com/archives/community/ 下载合适版本

./configure --prefix=/home/whtest/usr/local/mysql --with-named-curses-libs=/home/whtest/usr/local/ncurses/lib/libncurses.so.5 --enable-community-features --enable-profiling --with-unix-socket-path=/home/whtest/usr/local/mysql/tmp/mysql.sock
make && make install

创建my.cnf文件

先复制my-huge.cnf 到指定目录下,再修改其内容(mysqld)

cp ~/usr/local/mysql/share/mysql/my-huge.cnf ~/usr/local/mysql/etc/my.cnf
mkdir -p ~/usr/local/mysql/var
mkdir -p ~/usr/local/mysql/tmp

[mysqld]
port            = 3306
socket          = /home/whtest/usr/local/mysql/tmp/mysql.sock
log-error       = /home/whtest/usr/local/mysql/var/mysql.err
log             = /home/whtest/usr/local/mysql/var/mysqld.log
pid-file        = /home/whtest/usr/local/mysql/var/mysqld.pid
datadir         = /home/whtest/usr/local/mysql/var/
bind-address    = 0.0.0.0

[client]
socket          = /home/whtest/usr/local/mysql/tmp/mysql.sock

[mysql]
socket = /home/whtest/usr/local/mysql/tmp/mysql.sock

创建数据库

./mysql_install_db --datadir=/home/whtest/usr/local/mysql/var/

启动mysql脚本(.bash_profile)

PATH=$PATH:$HOME/bin:/home/whtest/usr/local/mysql/bin

alias mysql='mysql --defaults-file=/home/whtest/usr/local/mysql/etc/my.cnf'
alias startmysql='mysqld_safe --defaults-file=/home/whtest/usr/local/mysql/etc/my.cnf'
alias killmysql='kill -9 `cat /home/whtest/usr/local/mysql/var/mysqld.pid`'

允许外部IP访问

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

安装apache2.2.31

下载地址:http://www.apache.org/dist/httpd/

./configure --prefix=/home/whtest/usr/local/apache
--enable-deflate
--enable-expires
--enable-headers
--enable-modules=most
--enable-so
--with-mpm=worker
--enable-rewrite

make && make install

修改apache配置启动(httpd.conf)

Listen 8000
ServerName localhost:8000
apachectl start

安装PHP前的准备(安装依赖)

libtool-1.5.22.tar.gz
curl-7.15.0.tar.gz
libiconv-1.14.tar.gz
libmcrypt-2.5.8.tar.gz
gd-2.0.33.tar.gz
freetype-2.2.1.tar.gz
mhash-0.9.9.tar.gz
libxml2-2.6.26.tar.gz
jpegsrc.v6b.tar.gz (--with-shared,手动建目录)
libpng-1.2.10.tar.gz (--with-shared)

安装PHP5.3.4

./configure --prefix=/home/whtest/usr/local/php \
--with-config-file-path=/home/whtest/usr/local/php/etc \
--with-apxs2=/home/whtest/usr/local/apache/bin/apxs \
--with-mysql=/home/whtest/usr/local/mysql \
--with-mysql-sock=/home/whtest/usr/local/mysql/tmp/mysql.sock \
--with-mysqli=/home/whtest/usr/local/mysql/bin/mysql_config \
--with-pdo-mysql=/home/whtest/usr/local/mysql \
--with-gd=/home/whtest/usr/local/gd-2.0.33 \
--with-iconv-dir=/home/whtest/usr/local/libiconv \
--with-freetype-dir=/home/whtest/usr/local/freetype \
--with-jpeg-dir=/home/whtest/usr/local/jpeg \
--with-png-dir=/home/whtest/usr/local/png \
--with-zlib \
--with-libxml-dir=/home/whtest/usr/local/libxml2 \
--with-curl=/home/whtest/usr/local/curl \
--with-curlwrappers \
--with-openssl \
--with-xmlrpc \
--without-pear \
--with-gettext \
--with-mcrypt=/home/whtest/usr/local/libmcrypt \
--with-mhash=/home/whtest/usr/local/mhash \
--enable-magic-quotes \
--enable-safe-mode \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--enable-pcntl \
--enable-sockets \
--enable-zip \
--enable-soap

编译时出现如下错误
configure: error: Cannot find libmysqlclient_r ...

cd /home/whtest/usr/local/mysql/lib/mysql/
ln -s libmysqlclient.so.15.0.0 libmysqlclient_r.so

修改PHP的配置

将源文件中 php.ini-production 复制到
/home/whtest/usr/local/php/etc/
并且改名为php.ini

修改APACHE配置(httpd.conf)

下面位置的 Deny from all 改为 allow from all

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    allow from all
</Directory>

结尾添加

AddHandler php5-script php
AddType application/x-httpd-php .php .php5
AddType application/x-httpd-php-source .phps

VIM配置改动处

set nobackup
set termencoding=utf-8
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936
set fileencoding=utf-8

安装cmake

https://cmake.org/download/

安装mysql5.5(基于cmake)

cmake -DCMAKE_INSTALL_PREFIX=/home/whtest/usr/local/mysql5.5 \
-DCURSES_INCLUDE_PATH=/home/whtest/usr/local/ncurses/include \
-DCURSES_LIBRARY=/home/whtest/usr/local/ncurses/lib/libncurses.so \
-DMYSQL_DATADIR=/home/whtest/usr/local/mysql5.5/data \
-DSYSCONFDIR=/home/whtest/usr/local/mysql5.5/etc \
-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_UNIX_ADDR=/home/whtest/usr/local/mysql5.5/tmp/mysql.sock

make && make install