CentOS 7 编译安装Redis5.0
1、下载源码包
wget http://download.redis.io/releases/redis-5.0.9.tar.gz
2、解压
tar -xf redis-5.0.9.tar.gz
3、编译安装
cd redis-5.0.9
make
make install PREFIX=/usr/local/redis
4、复制配置文件到安装目录
mkdir /usr/local/redis/conf
cp redis.conf /usr/local/redis/conf
5、修改配置文件
vim /usr/local/redis/conf/redis.conf
把 daemonize no 改为 daemonize yes
把supervised 弄 改为 supervised auto
6、编写启动脚本
vim /lib/systemd/system/redis.service
[Unit]
Description=Redis
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/conf/redis.conf
ExecStop=/usr/local/redis/bin/redis-cli shutdown
Restart=on-failure
PrivateTmp=false
[Install]
WantedBy=multi-user.target
7、启动服务
systemctl start redis # 启动服务
systemctl enable redis # 开机自启