logo

Installing & Configuring Redis in CentOS 6

Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

This post describes installation & configuration of a single node installation, built on-top of CentOS6. It assumes that internet access is available from the OS.

Configuration of Redis

cd /home
curl http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm > epel-release-6-8.noarch.rpm
curl http://rpms.famillecollet.com/enterprise/remi-release-6.rpm > remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
yum -y install redis
rm -f remi-release-6*.rpm epel-release-6*.rpm

Finally, set the service to start on reboot, and start the Redis service:

chkconfig redis on
service redis start

Redis (by default) runs on TCP6379, with a Redis-specific protocol. To test that the installation has been successful:

redis-cli ping

If the result is 'PONG', installation is successful.

By default, Redis will bind itself to 127.0.0.1. This can be changed by amending the 'bind' directive in /etc/redis.conf. If you want it to listen on all interfaces, comment out the directive. Restart the Redis service for changes to take effect.

Additionally, if you want to enable a lightweight security layer on-top of Redis, you can add a client password. This is done by uncommenting the 'requirepass' line from within /etc/redis.conf, changing the password and restarting the Redis service.