How to Install and Configure Redis on CentOS 7

Try it in our public cloud & Get $50 Credit

Redis is a light, fast, configurable key-value store with a wide array of features. Publish-subscribe capabilities transform it into a simple message bus, while custom commands and extensibility make it suitable for new use cases. Rich data structures make it ideal for storing data from simple strings and numbers, to complex hashes and sets. The store can be queried in a variety of ways, and can be replicated across machines for high availability of your data. Data is stored in memory by default, but can also be persisted to disk in cases where durability is more critical than speed. If you’re looking for a simple data store or message queue, then Redis may be worth investigating.

Getting Started

To complete this guide, you will need the following:
• 1 Node (Cloud Server or Dedicated Server) running a clean installation of CentOS 7

When finished, Redis will be installed with a good configuration in place to get you started.


Let’s start by updating your CentOS installation. This step should be performed on a regular basis, and pulls in any currently available bugfixes and security patches.

yum -y update

Redis is shipped in its own custom RPM repository. We need to install the repo in order to fetch the Redis packages.

yum -y install epel-release

Now we’ll install the Redis server package.

yum install redis

It is now necessary to configure Redis. We’ll open up its default configuration file to ensure that Redis is bound to the local IP. Unless you are running a full Redis cluster, which is beyond the scope of this guide, this is the best way to secure your Redis store from unauthorized access.

nano /etc/redis.conf

Search for the line that begins with “bind”, changing it as follows:


Having done this, we now start the Redis server.

systemctl start redis.service

With Redis running, we must also enable it to launch on boot. Without this step, you’ll need to manually restart Redis every time your server reboots.

systemctl enable redis.service

Redis should now be operational. To test, we’ll connect locally and enter some data.

root@redis-node:~# redis-cli> set besthost "Globo.Tech"
OK> get besthost

Your data is now persisting, and can be subsequently retrieved.


Redis is now installed, securely configured, and set to launch on boot. You can now begin integrating it into your applications, or clustering it for high availability of your data. If this guide was helpful to you, kindly share it with others who may also be interested.