Ubuntu18.04编译安装redis-server并注册到systemd
Ubuntu18.04编译安装redis-server并注册到systemd
在官网下载源码包
https://redis.io/
或者直接下载
wget https://wood-bucket.oss-cn-beijing.aliyuncs.com/Linux/redis-5.0.5.tar.gz
以5.0.5版本为例
编译
tar -xzvf redis-5.0.5.tar.gz
cd redis-5.0.5
apt install gcc make -y
make
sudo vim /etc/systemd/system/redis-server.service
[Unit]
Description=Redis-server
[Service]
User=root
WorkingDirectory=/home/ubuntu/redis-5.0.5/
ExecStart=/home/ubuntu/redis-5.0.5/src/redis-server redis.conf
[Install]
WantedBy=default.target
sudo systemctl daemon-reload
sudo systemctl enable redis-server.service
sudo systemctl start redis-server.service