A.1 Installation on Debian or Ubuntu Linux
If you’re using a Debian-derived Linux, your first instinct will be to apt-get install redis-server, but this is probably the wrong thing to do. Depending on your version of Debian or Ubuntu, you could be installing an old version of Redis. As an example, if you’re using Ubuntu 10.4, you’d be downloading Redis 1.2.6, which was released in March 2010 and doesn’t support many of the commands that we use.
In this section, you’ll first install the build tools because you’ll compile Redis from scratch. Then you’ll download, compile, and install Redis. After Redis is running, you’ll download the Redis client libraries for Python.
To get started, make sure that you have all of the standard required build tools installed by fetching and downloading make, as can be seen in the following listing.
When your build tools are installed (they were probably installed before; this was a
verification step), you’ll take these steps:
- Download the most recent stable Redis source code from http://redis.io/download.
- Extract, compile, install, and start Redis.
- Download and install the necessary Redis client libraries for Python.
The first two steps in this process are shown next.
After you have Redis installed and running, you need to install the Redis client libraries for Python. You won’t bother to install Python, because Python 2.6 or 2.7 should already be installed by default on Ubuntu or Debian releases in the last few years. But you’ll download and install a simple helper package called setuptools, which will help you download and install the Redis client libraries.1 This last step of installing the Redis client libraries for Python is shown next.
Now that you have the Python libraries installed, you can skip ahead to section A.4 to test Redis from Python, which should prepare you for all of the other chapters.
1 Experienced Python users will ask “Why not pip?” which is another package for installing Python libraries. This is because virtualenv, which is necessary for the easy download of pip, is out of the scope of these instructions.