Installing Redis 2.2.4 on Ubuntu 10.10 & 11.04 and running with an ‘init’ script.
Following on from previous post on installing MongoDB 1.8.1, here are similar steps to getting Redis 2.2.4 running on Ubuntu 10.10 using an init script. The setup is intended to be used on 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.2.4.tar.gz tar -zxf redis-2.2.4.tar.gz cd redis-2.2.4 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 is pretty standard. However my redis.conf sets Redis up with 1Gb of virtual memory and 20Gb of swap space – 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 useradd redis sudo mkdir -p /var/lib/redis sudo mkdir -p /var/log/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!
