ubuntu 18.04 redis installation

attention: contents in the brackets are comments, do not copy!

  1. install
# wget http://download.redis.io/releases/redis-5.0.2.tar.gz 
# tar xzf redis-5.0.2.tar.gz 
# mv redis-5.0.2 /usr/local/redis/
# cd /usr/local/redis/
# make
# cd /usr/local/bin 
# ls -all
  1. configuration
 # cp /usr/local/redis/redis.conf /etc/redis/ 
 # vim /etc/redis/redis.conf
  • # bind 127.0.0.1
  • daemonize yes
  • logfile /var/log/redis/redis-server.log (log file)
  • dir /var/lib/redis (path of data files)
  1. self-starting when booting
vim /lib/systemd/system/redis.service

add contents bellow

[Unit]
Description=redis
After=network.target

[Service]
Type=forking
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/local/redis/src/redis-server /etc/redis/redis.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

# systemctl enable redis.service
# systemctl start redis
# ss -tnl
  1. References

https://redis.io/downloa https://blog.csdn.net/weixin_41114593/article/details/82383716

你可能感兴趣的:(ubuntu 18.04 redis installation)