下载最新的安装包后编译
make
make PREFIX=/usr/local/redis install
编译成功后 cp redis.conf 到/usr/local/redis/
设置systemctl的启动方式
vim /etc/systemd/system/redis.service
[Unit]
Description=Redis
After=network.target
[Service]
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf --daemonize no
ExecStop=/usr/local/redis/bin/redis-cli -a password shutdown # 将password 换成自己的redis密码
[Install]
WantedBy=multi-user.target
刷新systemctl 并测试启动停止是否正常
systemctl daemon-reload
systemctl status redis
systemctl start redis
systemctl stop redis
systemctl enable *.service #开机运行服务
systemctl disable *.service #取消开机运行
redis 配置相关
bind 0.0.0.0
requirepass trhdftght546jhdf
# save ""
Ubuntu redis 配置位置
cat /etc/redis/redis.conf
卸载
# 如果你使用 apt-get 方式安装的
# 您只需在终端中键入以下命令即可。这将删除 redis-server 软件包和不再需要的其他相关软件包(因为 --auto-remove 参数)。它还会删除 redis-server 的本地/配置文件(因为 purge 参数)。
sudo apt-get purge --auto-remove redis-server