一、环境准备
centos6.7 64位
安装gcc
yum install gcc-c++ -y
二、下载安装包:
cd /usr/local/ wget http://download.redis.io/releases/redis-5.0.5.tar.gz
三、编译安装
make && make PREFIX=/usr/local/redis install
四、复制配置文件并修改
cp /usr/local/redis-5.0.5/redis.conf ../redis
vi /usr/local/redis/redis.conf
protected-mode yes#设置后台启动
五、设置开机启动
1、复制文件
cp /usr/local/redis-5.0.5/utils/redis_init_script /etc/init.d/redis 2、修改如下参数: EXEC=/usr/local/redis/bin/redis-server CLIEXEC=/usr/local/redis/bin/redis-cli PIDFILE=/var/run/redis_${REDISPORT}.pid CONF="/usr/local/redis/redis.conf"
3、设置开机启动
chkconfig redis on
4、设置软连接
ln -s /usr/local/redis/bin/redis-server /usr/local/sbin/redis-server
ln -s /usr/local/redis/bin/redis-cli /usr/local/sbin/redis-cli
六、启动停止
service redis start service redis stop