rui lopes notebook

Updating the redis package on Ubuntu

Latest redis versions can take quite a while to appear in the official Ubuntu archives, but fortunately, updating a package is quite strait-forward. In this post I’m going to update the package that ships with Ubuntu 10.04 from version 1.2.0 to 2.0.4.

Before updating a package, we should check whether there is a recent version available on the archive:

http://archive.ubuntu.com/ubuntu/pool/universe/r/redis/?C=M;O=D

And in this case, there is 2.0.1! So we’ll base our work on that version.

To build a package we need to install the standard development tools:

sudo apt-get install build-essential patch devscripts patchutils fakeroot debhelper quilt

Get the latest available source package:

dget http://archive.ubuntu.com/ubuntu/pool/universe/r/redis/redis_2.0.1-2.dsc

Get the latest redis source tarball, and unpack it:

wget http://redis.googlecode.com/files/redis-2.0.4.tar.gz -O redis_2.0.4.orig.tar.gz
tar xf redis_2.0.4.orig.tar.gz
cd redis-2.0.4

Unpack the debian specific files from the previous Ubuntu package:

tar xf ../redis_2.0.1-2.debian.tar.gz

Add new entry into the debian changelog:

dch -i
redis (2:2.0.4-1ubuntu1) lucid; urgency=low
  * New upstream release.
-- Rui Lopes <rgl@ice>  Sun, 07 Nov 2010 22:00:26 +0000

See if the config file is more-or-less the same as it was in the previous package:

diff -u redis.conf debian/redis.conf | vim -

In this particular case, the configuration wasn’t changed, so we have nothing to tweak.

Finally, build the source and create the package:

dpkg-buildpackage -rfakeroot -uc -b

Install the package with:

sudo dpkg -i ../redis-server_2.0.4-1ubuntu1_amd64.deb

You should now have redis up and ready for a test drive! So, lets try to connect to redis to get some basic status:

redis-cli
redis> INFO
redis_version:2.0.4
redis_git_sha1:1c145073
redis_git_dirty:0
arch_bits:64
multiplexing_api:epoll
process_id:8345
uptime_in_seconds:63
uptime_in_days:0
connected_clients:1
connected_slaves:0
blocked_clients:0
used_memory:781568
used_memory_human:763.25K
changes_since_last_save:0
bgsave_in_progress:0
last_save_time:1289167394
bgrewriteaof_in_progress:0
total_connections_received:1
total_commands_processed:0
expired_keys:0
hash_max_zipmap_entries:64
hash_max_zipmap_value:512
pubsub_channels:0
pubsub_patterns:0
vm_enabled:0
role:master

And that’s it!

– RGL