25.1 C
Senior Writer and partner

How to install Redis on CentOS 8?

Hello, friends in this post, we will show you how to install Redis on CentOS 8

As we well know CentOS 8 is a great operating system that is used in many servers. That’s why it has quite important tools in this area as is the case of Redis.

For those who don’t know, Redis is a database engine in memory, based on storage in hash tables (key/value). Thanks to its speed and ease of use, Redis is a popular choice for web, mobile, gaming, advertising technology, and IoT applications. Also, it is released under the BSD license which makes it open-source.

So, whenever you need to enter and request data quickly, Redis is a good alternative to traditional relational databases.

- Advertisement -

So today you will learn how to install it.

Install Redis on CentOS 8

Redis on RHEL 8 is available on the AppStream repository. Therefore it is not complicated to install it on CentOS 8 and even RHEL 8. So to do so, just run the following command in a terminal session:

sudo yum install @redis
Failed to set locale, defaulting to C.UTF-8
CentOS-8 - AppStream 7.2 kB/s | 4.3 kB 00:00
CentOS-8 - AppStream 601 kB/s | 5.8 MB 00:09
CentOS-8 - Base 7.7 kB/s | 3.9 kB 00:00
CentOS-8 - Base 359 kB/s | 2.2 MB 00:06
CentOS-8 - Extras 2.5 kB/s | 1.5 kB 00:00
CentOS-8 - Extras 3.5 kB/s | 8.1 kB 00:02
Dependencies resolved.
Package Architecture Version Repository Size
Installing group/module packages:
redis x86_64 5.0.3-2.module_el8.2.0+318+3d7e67ea AppStream 925 k
Installing module profiles:
Enabling module streams:
redis 5
Transaction Summary
Install 1 Package
Total download size: 925 k
Installed size: 3.2 M
Is this ok [y/N]:
1.- Install Redis on CentOS 8
1.- Install Redis on CentOS 8

It’s that simple. The next step is to make Redis run as soon as the system starts. To do this we use the systemctl command.

sudo systemctl enable redis

Now we need to start the service:

sudo systemctl start redis

Check the status of the service to make sure everything is going well:

sudo systemctl status redis
● redis.service - Redis persistent key-value database
Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/redis.service.d
Active: active (running) since Mon 2020-09-21 15:45:03 EDT; 1s ago
Main PID: 1370 (redis-server)
Tasks: 4 (limit: 2860)
Memory: 1.4M
CGroup: /system.slice/redis.service
└─1370 /usr/bin/redis-server
Sep 21 15:45:03 osradar systemd[1]: Starting Redis persistent key-value database…
Sep 21 15:45:03 osradar systemd[1]: Started Redis persistent key-value database.
2.- Redis status
2.- Redis status

Now we have to configure it and leave it ready.

Configuring Redis

The Redis configuration file is /etc/redis.conf. In this file, you can configure many things like the port or a password.

The first thing to do in this file is to make Redis listen and accept connections from all directions. Especially useful if Redis will tolerate many simultaneous connections.

So, open the Redis configuration file:

sudo nano /etc/redis.conf

And locate the line:


This line means that only listen to connections through localhost. Change it to:


And so you will hear requests from all directions. But you can also specify an IP address.

By default, Redis uses port 6379 but you can change it in the port directive.

port 6379

If you want to request a password to execute the commands in Redis, add the following directive:

requirepass [password]

In the end, save the changes and close the editor.

For the changes to take effect, restart the service.

sudo systemctl restart redis

Now, verify that Redis is listening for all requests from IP addresses under the specified port.

ss -tunelp | grep 6379
tcp LISTEN 0 128* uid:993 ino:22936 sk:6 <->

Then, open the Redis port in the Firewall:

sudo firewall-cmd --add-port=6379/tcp --permanent
sudo firewall-cmd --reload

Then open the Redis console:


And if you try to make a command, it will give an error because we need the password that we will have defined before. In case you haven’t done it, you won’t see an error.> ping
(error) NOAUTH Authentication required.>
3.-Redis CLI
3.-Redis CLI

In order to use them, the password must be specified:> AUTH angelo

And now we can execute any command, for example, the ping.> ping

So, Redis is ready.


Redis is a program that is becoming more and more necessary on servers. So if you plan to study something related to servers, it is convenient to have it at hand. And in this post, you have learned how to install it in CentOS 8.

So, share this post and join our Telegram Channel.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article