October 21, 2021
how to install redis on Centos 8

How To Install Redis on CentOS 8

On this article we will discuss how to install Redis version 5.0 on CentOS 8.


Redis is an open source in-memory data structure store, used as a database, cache and message broker. Redis is an acronym for Remote dictionary server. Redis supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes with radius queries and streams.

Redis is in the family of databases called key-value stores. The essence of a key-value store is the ability to store some data, called a value, inside a key. This data can later be retrieved only if we know the exact key used to store it. Often Redis it is called a data structure server because it has outer key-value shell, but each value can contain a complex data structure, such as a string, a list, a hashes, or ordered data structures called sorted sets as well as probabilistic data structures like hyperloglog.

Redis Installation on CentOS 8

The installation of Redis is quite simple, on this articel we are using Redis repository that was enabled on CentOS 8 system. Installation steps will be explained below :


We have to prepare the system and all related supported matters for installation.

  1. CentOS 8 system with enough free memory for Redis
  2. Account with sudo privilege
  3. Update the CentOS 8 system

Install Redis

We will using Redis repository on CentOS 8 for installation.

1. Install Redis

[ramans@otodiginet ~]$ sudo dnf install @redis

The output will be :

Last metadata expiration check: 0:10:05 ago on Wed 07 Oct 2020 06:24:43 PM PDT.
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]: y
Downloading Packages:
redis-5.0.3-2.module_el8.2.0+318+3d7e67ea.x86_64.rpm 357 kB/s | 925 kB 00:02
Total 234 kB/s | 925 kB 00:03
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: redis-5.0.3-2.module_el8.2.0+318+3d7e67ea.x86_64 1/1
Installing : redis-5.0.3-2.module_el8.2.0+318+3d7e67ea.x86_64 1/1
Running scriptlet: redis-5.0.3-2.module_el8.2.0+318+3d7e67ea.x86_64 1/1
Verifying : redis-5.0.3-2.module_el8.2.0+318+3d7e67ea.x86_64 1/1
Installed products updated.
Redis installation

The output will be :

2. Enable and Start Redis Services

[ramans@otodiginet ~]$ sudo systemctl enable redis
Created symlink /etc/systemd/system/multi-user.target.wants/redis.service → /usr/lib/systemd/system/redis.service.
[ramans@otodiginet ~]$ sudo systemctl start redis

Then we check the Redis status, bu submitting command line :

[ramans@otodiginet ~]$ sudo systemctl status redis

The output will be :

● 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 Wed 2020-10-07 18:35:31 PDT; 1min 0s ago
Main PID: 11761 (redis-server)
Tasks: 4 (limit: 49614)
Memory: 6.8M
CGroup: /system.slice/redis.service
└─11761 /usr/bin/redis-server
Oct 07 18:35:31 otodiginet systemd[1]: Starting Redis persistent key-value database…
Oct 07 18:35:31 otodiginet systemd[1]: Started Redis persistent key-value database.

Configuring Redis

Enable Redis To Listen in All Network Interface

Now, the Redis has been installed and running on CentOS 8 system, the next step is configuring Redis. There are lot of parameters that can be configured to fit for our needs. The configuration file is located on /etc/redis.conf file. On this tutorial, we will enable the Redist to be accessed from other network.

By default Redis services is only enable for local network, then we will enable it to all interface network. By changing local IP address binding to all network interface (binding on IP Address).

ramans@otodiginet ~]$ sudo vi /etc/redis.conf

Setting Password

We are suggested to set password for AUTHentication. The section is reside on Security are of this file. On this tutorial we set requirepass otopass01

Warning: since Redis is pretty fast an outside user can try up to
150k passwords per second against a good box. This means that you should
use a very strong password otherwise it will be very easy to break.
requirepass foobared
requirepass otopass01

To make the change, we have to restart Redis services.

[ramans@otodiginet ~]$ sudo systemctl restart redis

Then we verify the IP Address binding and listening port, by submitting command line below:

[ramans@otodiginet ~]$ ss -tunelp | grep 6379
tcp LISTEN 0 128* uid:966 ino:107969 sk:e <->
Redis is listening from all network interface port 6379

If we are deploying firewall on our system, the we make port 6379 to be allowed, by sybmitting command line below:

[ramans@otodiginet ~]$ sudo firewall-cmd --add-port=6379/tcp --permanent
[ramans@otodiginet ~]$ sudo firewall-cmd --reload

Connectiong To Redis

We have set password for entering Redis on /etc/redis.conf file. On this section we will try to connect to our Redis. We have to supply the password for authenticating.

Here is the steps for connecting to Redis locally.

ramans@otodiginet ~]$ redis-cli> AUTH otopass01
OK> info server
os:Linux 4.18.0-193.14.2.el8_2.x86_64 x86_64

So far, we have install and tried to connect to our Redis, and all steps are successfully completed.


The Redis version 5.0.3 installation on CentOS 8 is completed done. For more information about Redis can be found on redis.io website. Just drop your comments for your insight on Redis. Have a nice day, Stay at home and stay safe.

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *