Centos7下编译安装Redis

作者: 程序员阿晨 | 来源:发表于2020-05-13 21:42 被阅读0次

1、安装依赖 gcc
yum install gcc-c++
2、下载Redis的源码包:
wget http://download.redis.io/releases/redis-5.0.4.tar.gz
3、解压源码包:
tar -zxvf redis-5.0.4.tar.gz
4、进入到解压目录:
cd redis-5.0.4.tar.gz
5、执行make:
make
6、安装到指定目录:
make PREFIX=/usr/local/redis install
7、启动:
redis-server 配置文件路径
配置文件:daemonize yes (允许后台运行)
8、设置Redis为systemctl守护进程:vim /etc/systemd/system/redis.service

[Unit]
Description=Redis
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf
ExecStop=/usr/local/redis/bin/redis-server -s stop
PrivateTmp=true
User=root
Group=root

[Install]
WantedBy=multi-user.target

设置开机启动:systemctl enable redis
启动Redis:systemctl start redis
停止Redis:systemctl stop redis
重启Redis:system restart redis
查看状态:systemctl status redis

相关文章

网友评论

    本文标题:Centos7下编译安装Redis

    本文链接:https://www.haomeiwen.com/subject/hjzonhtx.html