Alex Scotton

App & Web Developer

Installing Redis 2.8 as a service on Ubuntu 13.10

Posted by Alex Scotton on 22/3/2014

An installation guide for the latest stable Redis Server (2.8.7).

Install dependencies

$ sudo apt-get -y install build-essential tcl8.5

Download source, compile and install

$ cd ~/Downloads
$ wget http://download.redis.io/releases/redis-2.8.7.tar.gz
$ tar -xvf redis-2.8.7.tar.gz
$ cd redis-2.8.7
$ make
$ sudo make install

Configure Redis

$ sudo useradd -r redis
$ sudo mkdir -p /etc/redis /var/lib/redis /var/log/redis
$ sudo chown redis:redis /var/lib/redis /var/log/redis
$ sudo cp src/redis.conf /etc/redis

Open up the redis config and make the following changes

$ sudo nano /etc/redis/redis.conf
[..]
daemonize yes
[..]

[..]
bind 127.0.0.1
[..]

[..]
dir /var/lib/redis
[..]

Create and configure the Redis service

$ wget https://gist.githubusercontent.com/lsbardel/257298/raw/d48b84d89289df39eaddc53f1e9a918f776b3074/redis-server-for-init.d-startup
$ sudo mv redis-server-for-init.d-startup /etc/init.d/redis-server
$ sudo chmod +x /etc/init.d/redis-server

Open up the init.d script and edit the following line:

$ sudo nano /etc/init.d/redis-server
[..]
DAEMON=/usr/local/bin/redis-server
[..]

Now set the service to launch at boot and start the service

$ sudo update-rc.d redis-server defaults
$ sudo service redis-server start