Install Redis 2.6 from source on Ubuntu 12.04 and running as a daemon

Update: if you want a quick and easy way to install Redis and can live with Redis 2.2, checkout - Easy way to install Redis on Ubuntu 12.04.

Documented here are steps to getting Redis 2.6.x running on Ubuntu 12.04 onwards using an init script (previous versions of Ubuntu should work too). The setup is intended to be used on a developer desktop/laptop rather than production infrastructure.

As ever, first download and unzip Redis from here.

cd /tmp
wget http://redis.googlecode.com/files/redis-2.6.9.tar.gz
tar -zxf redis-2.6.9.tar.gz
cd redis-2.6.9
make
sudo make install

Your Redis binaries should now be located in /usr/local/bin.

To get an init script and Redis config working cleanly with this setup, download my init and config files from my Github ‘dotfiles’ repo. My init script and redis.conf are pretty standard - intended for general development purposes.

wget https://github.com/ijonas/dotfiles/raw/master/etc/init.d/redis-server
wget https://github.com/ijonas/dotfiles/raw/master/etc/redis.conf
sudo mv redis-server /etc/init.d/redis-server
sudo chmod +x /etc/init.d/redis-server
sudo mv redis.conf /etc/redis.conf

Before you can fire up the Redis server for the first time, you'll need add a redis user and prep a data and logging folder.

sudo mkdir -p /var/lib/redis
sudo mkdir -p /var/log/redis
sudo useradd --system --home-dir /var/lib/redis redis
sudo chown redis.redis /var/lib/redis
sudo chown redis.redis /var/log/redis

Also, you need to activate your Redis services init script by adding it to your system's run-level configuration. That way the service will startup during the boot sequence and stop nicely during the OS' shutdown procedure.

sudo update-rc.d redis-server defaults

You're now ready to launch Redis server with

sudo /etc/init.d/redis-server start

Good luck!