[root@localhost ~]# cd /usr/local
//自己有包的话也可以自己传上去
[root@localhost local]# wget http://download.redis.io/releases/redis-5.0.5.tar.gz
[root@localhost local]# tar xzf redis-5.0.5.tar.gz
//改名
[root@localhost local]# mv redis-5.0.5 redis
[root@localhost local]# cd redis
[root@localhost redis]# make
[root@localhost redis]# make install PREFIX=/usr/local/redis
[root@localhost redis]# vim redis.conf
// 修改如下
#bind 127.0.0.1
protected-mode no
daemonize yes
[root@localhost redis]# cp redis.conf /usr/local/redis/bin/
[root@localhost redis]# cd bin/
// 启动可跳过
[root@localhost redis]# ./redis-server redis.conf
// 编写service文件
[root@localhost redis]# cd utils
[root@localhost utils]# cp redis_init_script /etc/init.d/redis
[root@localhost redis]# vim /etc/init.d/redis
// 修改CONF
EXEC=/usr/local/redis/bin/redis-server
CLIEXEC=/usr/local/redis/bin/redis-cli
PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/usr/local/redis/bin/redis.conf"
[root@localhost redis]# chmod +x /etc/init.d/redis
[root@localhost redis]# chown root:root /etc/init.d/redis
// 配置开机启动
[root@localhost redis]# chkconfig redis on
网友评论