文章目录
实验前提
- 已完成源码安装并能正常启动redis
bash
/usr/local/bin/redis-server
能正常启动redis
实验
bash
vim /etc/systemd/system/redis.service
内容如下:
bash
[unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/bin/redis-server
PrivateTmp=true
[Install]
WantedBy=multi-user.target
尝试启动服务
bash
systemctl start redis
设置开机启动
bash
systemctl enable redis