How to Install Redis on CentOS 8

Redis is a popular and open-source in-memory key-value or data structure store that is used as a distributed database, message broker, and cache. Redis supports data structures, such as Lists, Strings, and Sets, and it is widely recognized due to its broad support, performance, availability, and flexibility. This article shows you how to install and configure Redis on the CentOS 8 operating system.

Install Redis on CentOS 8

Redis is available in the official repository of CentOS 8 and can be installed quite easily as such. There are no significant obstacles to overcome during the installation process. Simply follow the procedure given below to install Redis on your CentOS 8 system.

As always, it is a good practice to update the dnf repository cache. Issue the command given below to update the dnf repository cache:

$ sudo dnf makecache

After updating the repository cache, upgrade the system’s packages, as well, by entering the command given below:

$ sudo dnf upgrade

Now, the system is up-to-date and ready to install Redis. To install Redis on CentOS 8 using the DNF package manager, issue the following command:

$ sudo dnf install redis -y

And that is it; version 5.0.3 of Redis is now installed on the CentOS 8 operating system. Next, we will configure Redis on CentOS 8.

Configure Redis on CentOS 8

To configure Redis on CentOS 8, first, the Redis service must be running on the CentOS 8 system.

First, check the status of Redis service by issuing the command given below:

$ sudo systemctl status redis.service

If Redis is inactive, then start the service by entering the following command:

$ sudo systemctl start redis.service

Redis may not be enabled on system startup. Enable the Redis service on boot by entering the command given below:

$ sudo systemctl enable redis.service

After successfully starting the Redis service, you can confirm that the service is active by pinging it using the Redis CLI command-line tool.

$ redis-cli ping

If Redis responds with the output “PONG,” this means that the Redis service is running perfectly fine. Now, we can configure the Redis server.

All the configurations can be performed in the “redis.conf” file located in the “/etc” directory. Edit the configuration file in the nano editor using the following command:

$ sudo nano /etc/redis.conf

In this configuration file, to bind Redis to another private IP address, find the line starting with bind, uncomment the line if it is commented, and provide the IP address in place of ‘’

After completing the configuration, restart the Redis service. Otherwise, the changes will not be applied.

$ sudo systemctl restart redis.service

Now, we will configure the firewall to allow traffic from port 6379.

First, add the Redis zone.

$ sudo firewall-cmd --permanent --new-zone=redis

After adding the new zone, add port 6379.

$ sudo firewall-cmd --permanent --zone=redis --add-port=6379/tcp

Now, add the private IP address that you want to allow to pass through the firewall.

$ sudo firewall-cmd --permanent --zone=redis --add-source=<the-private-IP-address>

Finally, reload the firewall.

$ sudo firewall-cmd --reload

That is it. The firewall is configured.


Redis is a powerful key-value data store. This article showed you how to install and configure Redis on the CentOS 8 operating system. You also learned how to configure Redis to set it for remote access, as well as how to configure the firewall for Redis.

About the author

Shehroz Azam

Shehroz Azam

A Javascript Developer & Linux enthusiast with 4 years of industrial experience and proven know-how to combine creative and usability viewpoints resulting in world-class web applications. I have experience working with Vue, React & Node.js & currently working on article writing and video creation.