cd /download
wget wget http://download.redis.io/releases/redis-4.0.11.tar.gz
tar xvf redis-4.0.11.tar.gz
cd redis-4.0.11
make
make install
mkdir -p /var/redis/6379 # Redis的PID文件位置
mkdir -p /etc/redis # 配置文件
cp /download/redis-4.0.11/redis.conf /etc/redis/6379.conf
cd /etc/redis
vim 6379.conf
# 修改以下内容
daemonize = yes
port = 6379
pidfile = /var/run/redis_6379.pid
dir= /var/redis/6379
cd /etc/init.d/
cp /download/redis-4.0.11/utils/redis_init_script /etc/init.d/redis_6379
vim /etc/init.d/redis_6379
# 加入以下内容
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
/etc/init.d/redis_6379 start
/etc/init.d/redis_6379 stop
# 设置开机执行redis脚本
chkconfig redis_6379 on
# 杀掉以前的redis进程。否则执行stop时,可能会报[/var/run/redis_6379.pid does not exist, process is not running]的错误
ps -ef | grep "redis"
kill 5013
service redis_6379 start
service redis_6379 stop