David - Musings of an SRE

How to Redis from Source to Daemon

  1. Make sure you have a server. I’d recommend spinning up an Amazon EC2 instance.

  2. Grab the latest redis. At this point of writing, it is:

$ wget http://redis.googlecode.com/files/redis-2.6.14.tar.gz
$ tar xzf redis-2.6.14.tar.gz
$ cd redis-2.6.14

You can do this in any directory, I recommend making a tmp/ directory in your home directory.

  1. Run a make and make test!
$ make && make test
  1. Copy the redis/* content into a accessible folder.
/home/me/tmp/redis-2.6.14/$ sudo mkdir /etc/redis
/home/me/tmp/redis-2.6.14/$ sudo cp -rf * /etc/redis/
  1. Edit the redis.conf!
/etc/redis/$ sudo vim redis.conf
  1. Change daemonize to yes
# /etc/redis/redis.conf
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes
  1. Setup the symbolic links to redis-server
/usr/bin/$ sudo ln -s /etc/redis/src/redis-server .
  1. Setup the init script
$ sudo wget -O /etc/init.d/redis-server https://gist.github.com/davidchua/6062428/raw/ 
$ sudo chmod 755 /etc/init.d/redis-server 
$ sudo update-rc.d redis-server defaults # run it on startup
  1. Boomz.
$ sudo service redis-server start

You should see a ‘starting …’ type of output.

Source: Redis