开发环境的配置,记录一下。
1. 配置VIM
# tab替换为4个空格
# vim ~/.vimrc
set ts=4
set expandtab
2. 升级Git版本
# 卸载旧版本
yum remove -y git
# 安装依赖包
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
yum install gcc perl-ExtUtils-MakeMaker
# 安装新版本
wget https://www.kernel.org/pub/software/scm/git/git-2.8.6.tar.gz
tar -zxf git-2.8.6.tar.gz
cd git-2.8.6
make configure
./configure --prefix=/usr/local/git
make
make install
# 建立软链接
ln -s /usr/local/git/bin/git /usr/bin/git
3. 配置Git命令自动补全
# 下载脚本|注意对应版本号
wget https://raw.githubusercontent.com/git/git/v2.8.6/contrib/completion/git-completion.bash
mkdir -p /etc/bash_completion.d/
mv git-completion.bash /etc/bash_completion.d/
# 配置环境变量
vim ~/.bashrc
# 增加以下代码
# Git bash autoload
if [ -f /etc/bash_completion.d/git-completion.bash ]; then
. /etc/bash_completion.d/git-completion.bash
fi
# 立即生效
. /etc/bash_completion.d/git-completion.bash
4. 安装Node环境
# 下载node(二进制软件包|免编译)
wget https://nodejs.org/dist/v6.11.2/node-v6.11.2-linux-x64.tar.xz
# 解压并转移目录
tar -Jxf node-v6.11.2-linux-x64.tar.xz -C /usr/local/node
# 建立软链接
ln -s /usr/local/node/bin/node /usr/local/bin/node
ln -s /usr/local/node/bin/npm /usr/local/bin/npm
# 配置npm淘宝镜像
npm config set registry https://registry.npm.taobao.org
# 安装pm2管理工具
npm install pm2 -g
# 建立软链接
ln -s /usr/local/nodejs/lib/node_modules/pm2/bin/pm2 /usr/local/bin/pm2
5. 安装Redis
# 下载Redis
wget http://download.redis.io/releases/redis-4.0.1.tar.gz
# 解压
tar -zxf redis-4.0.1.tar.gz -C /usr/local/redis
# 编译
cd /usr/local/redis
make
make install
# 配置
# vim /usr/local/redis/redis.conf
daemonize yes # 后台进程
dir /data/backup/redis # dump文件路径
logfile "/data/wwwlogs/redis.log" # 日志路径
maxmemory 128MB # 设置内存
# 启动
/usr/local/bin/redis-server /usr/local/redis/redis.conf