Compile latest redis on CentOS 6
As of the time of writing, nobody has a redis package made for CentOS 6. The latest redis on CentOS is 2.2 but 2.4 is better than 2.2 thus it's better to compile your own.
To do so, just follow this:
yum install make gcc
wget http://redis.googlecode.com/files/redis-2.4.0.tar.gz
tar xzf redis-2.4.0.tar.gz
cd redis-2.40
make
Once it's done you should be able to do a ls src to see redis-server and other compiled binaries.
All that's left is to:
cp src/redis-check-dump src/redis-check-aof src/redis-benchmark src/redis-cli /usr/local/bin
cp src/redis-server /usr/local/sbin
mkdir /etc/redis
cp redis.conf /etc/redis/6379.conf
cp utils/redis_init_script /etc/init.d/redis_6379
mkdir /var/log/redis/
mkdir /var/redis/
mkdir /var/redis/6379/
useradd -M -r --home-dir /var/redis redis
touch /var/log/redis/6379.log
chown -R redis:redis /var/log/redis/ /var/redis/
vi /etc/init.d/redis_6379Edit as required.
vi /etc/redis/6379.confSet demonize to yes
Set pidfile to /var/run/redis_6379.pid
Set logfile to /var/log/redis/6379.log
Set dir to /var/redis/6379
chkconfig --add redis_6379
chkconfig redis_6379 on
Note what I have done is basically setup a script to run redis on port 6379 only. This is not the same as other tutorials and init scripts out there that assumes you're running one instance. The reason I've done it like this is because according to: http://redis.io/topics/faq redis is single threaded, and in order to take advantage of multi-core systems, it is advised to instantiate a seperate instance in a different port.
Unfortunately, I'm no expert in init scripts so I used the default scripts which runs the service as root. It would be great if there is a script that is similar to the default script that runs the service as redis (which was my original intention as I added a redis user). I'll see if I can deal with this and update this post later.
To remove at a later date
Just rm -rf /var/log/redis /var/redis /etc/redis and remove redis-* from /usr/local/bin and /usr/local/sbin and remove redis_* from /etc/init.d and chkconfig. You may also remove the redis user.
To update at a later date
Compile as I've done above the new version into a new directory and replace the binaries in /usr/local/bin and /usr/local/sbin, use the new config file as base if a lot has changed, otherwise you should be able to use the old one in /etc/redis/
Version
Last Updated
First Published
Comments
Any published comments will adhere to the etiquette policy and all e-mail addresses will be treated in accordance to the privacy policy.
Me in real-time
- If you see this, something's wrong with Twitter.
Blatant Plug
Support
I've pledged my support to these organisations, and I think you should too.






