下载:
cd /opt/
wget http://download.redis.io/releases/redis-5.0.3.tar.gz
tar -zxvf 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
后台启动:cp /usr/local/redis-5.0.3/redis.conf /usr/local/redis/bin/
修改 redis.conf 文件,把 daemonize no 改为 daemonize yes
vi redis.conf
./redis-server redis.conf
设置开机启动:
vi /etc/systemd/system/redis.service
[Unit]Description=redis-serverAfter=network.target [Service]Type=forkingExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.confPrivateTmp=true [Install]WantedBy=multi-user.target
systemctl daemon-reload
systemctl start redis.service
systemctl enable redis.service
设置开机启动:
systemctl daemon-reload
systemctl start redis.service
systemctl enable redis.service
ln -s /usr/local/redis/bin/redis-cli /usr/bin/redis