- Install pre-requisities
sudo apt-get install build-essential tcl
- Install Redis
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 install
- Configure Redis
sudo mkdir /etc/redis
sudo cp /tmp/redis-stable/redis.conf /etc/redis
sudo nano /etc/redis/redis.conf
In the file, change the supervised
directive's value to systemd
.
...
supervised systemd
...
Next, specify the working directory for Redis. This is the directory that Redis will use to dump persistent data. We can use /var/lib/redis
...
dir /var/lib/redis
...
Save and close the file.
- Configure systemd to start Redis on boot
sudo nano /etc/systemd/system/redis.service
Copy the contents of this gist to the file, save and close.
- Create Redis user, group and directories
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/redis
- Start the Redis service and set Redis to start on boot
sudo systemctl start redis
sudo systemctl enable redis
I also had to update my redis config to run as a daemon using
daemonize yes