Install required packages:
$ sudo apt-get update$ sudo apt-get install build-essential tclDownload Redis, build it, and then install it:
$ cd /tmp$ curl -O http://download.redis.io/redis-stable.tar.gz$ tar xzvf redis-stable.tar.gz$ cd redis-stable$ make$ make test$ sudo make installCreate a dedicated user for Redis and prepare the storage location:
$ sudo adduser --system --group --no-create-home redis$ sudo mkdir /var/lib/redis$ sudo chown redis:redis /var/lib/redis$ sudo chmod 770 /var/lib/redisUpdate Redis configuration:
$ sudo mkdir /etc/redis$ sudo cp /tmp/redis-stable/redis.conf /etc/redis$ sudo vim /etc/redis/redis.conf# redis.confsupervised systemddir /var/lib/redisCreate systems unit file:
$ sudo vim /etc/systemd/system/redis.service# redis.service[Unit]Description=Redis In-Memory Data StoreAfter=network.target
[Service]User=redisGroup=redisExecStart=/usr/local/bin/redis-server /etc/redis/redis.confExecStop=/usr/local/bin/redis-cli shutdownRestart=always
[Install]WantedBy=multi-user.targetStart redis service:
$ sudo systemctl start redis$ sudo systemctl status redis$ redis-cli pingDo some testing:
$ redis-cliset test "It's working!"get testexit
# Restart and test the get$ sudo systemctl restart redis$ redis-cliget testdel testEnable Redis to start at boot:
$ sudo systemctl enable redis