Ubuntu18.04 compile and install redis-server and register to systemd

Ubuntu18.04 compile and install redis-server and register to systemd

In the official website to download source packages

https://redis.io/

Or download

wget https://wood-bucket.oss-cn-beijing.aliyuncs.com/Linux/redis-5.0.5.tar.gz

To 5.0.5 version, for example

Compile

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

Guess you like

Origin www.cnblogs.com/zhangweijie01/p/12100527.html