安装gcc依赖
yum install -y gcc
下载
wget [http://download.redis.io/releases/redis-5.0.3.tar.gz](http://download.redis.io/releases/redis-5.0.3.tar.gz)
解压
tar -xvzf redis-5.0.3.tar.gz
进入目录
cd redis-5.0.3
编译
make
安装
make install PREFIX=/usr/local/redis
- 直接前台启动
cd /usr/local/redis/bin/
./redis-server
- 后台启动
复制源码目录的redis.conf到 redis 的安装目录
[root@localhost bin]# cp /home/ycj/redis-5.0.3/redis.conf /usr/local/redis/bin/
修改 redis.conf 文件,把 daemonize no 改为 daemonize yes
- 设置开机启动(需要先设置后台启动)
vim /usr/lib/systemd/system/redis.service
[Unit]
Description=redis
After=network.target
[Service]
Type=forking
ExecStart=/home/ycj/redis-5.0.3/src/redis-server /home/ycj/redis-5.0.3/redis.conf
ExecReload=/home/ycj/redis-5.0.3/src/redis-server -s reload
ExecStop=/home/ycj/redis-5.0.3/src/redis-server -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl enable redis.service
systemctl status redis.service
systemctl stop redis.service
systemctl start redis.service
网友评论