Special offer
+370 5 205 5502 sales@monovm.com

How to install Redis on CentOS 8

How to install Redis on CentOS 8, Redis or Remote Dictionary Server is an in-memory data structure project. In this tutorial we will go through the set up of Redis on CentOS 8.

20 Oct, 20 by Susith Nonis 12 min Read

List of content you will read in this article:


According to Wikipedia, this Remote Dictionary Server is an in-memory data structure project. It implements a distributed, in-memory key-value database. This process comes with optional durability.

Benefits of using Redis

You might have heard and been aware of MySQL, the fully managed database to deploy cloud-native applications. But Redis is a NoSQL database. The important property of Redis that it stores data as a key-value pair whereas in regular databases, you have to create rows. 

The regular databases use columns and tables to associate them with each other and define different filters and titles to every record. You have to manually add the information in each row to fill the whole database with information. Unlike relational databases like MySQL, Redis is a NoSQL database which stores data as a key-value pair.

The data feeding process in Redis has made it very easy, simple, and straightforward. The whole system is quite flexible and intelligently connected. Redis gives you maximum productivity without taking any substantial effort from you.

The most significant use of Redis is that people use it as a catching system. It is a flexible database, yet it provides you the persistence and connectivity in high fidelity to all data written on it.

The storage and retrieval process, both are super-fast making it possible to write and retrieve data like a flash. The cache system is robust and can outrun the interruptions and withstand failures.

Ships are connected with the master and slave data connectivity processes. When you made a change into the master node, the master-slave replication feature applies the single change on the master node to all the slave nodes connected. Redis astounds programmers and data analysts by a staggering storage ability to handle large keys and value pairs up to 512 MB.

Raspberry Pi and Arduino to support IoT apps easily install and handle Redis because of its very small footprint.

This is a cross-platform system, which is the most productive, efficient, and flexible database; you can even install it on Windows, Mac, and Linux server.

Abstract data structure Redis supports:

There are various kinds of abstract data structures which it supports flexibility, some of these are:

  • Strings
  • Lists
  • Maps
  • Sets
  • Sorted sets
  • HyperLogLogs
  • Bitmaps
  • Streams
  • Spatial indexes

Salvatore Sanfilippo developed this project in 2019, and Redis Labs sponsored this project; that's why it is called Redis. 

Install Redis on CentOS 8:

This key value-data structure is mainly used as a database. People also use it as a message broker or as a cache. This database supports a wide variety of languages with high-performance flexibility. In this tutorial, you would learn how to install Redis on CentOS 8.


Before you can start Redis's installation process on CentOS 8, make sure that you have a non-root user account on your server with Sudo privileges. Always enable IPv6 on your server, or you will not have the installation started.

Install Redis:

This package is not readily available in CentOS 8. You need to install the Redis form other repositories. Like:


  • Yum-utils
  • Epel-release packages

Use the following command to complete the installation:

sudo yum install epel-release yum-utils

Then Add the Remi repository using this command:

sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Enable this repository by running the below command:

sudo yum-config-manager --enable remi

Now install Redis run give this command:

sudo yum install redis

You will have to start Redis through this command manually:

sudo systemctl start redis

Then enable Redis service through this:

sudo systemctl enable redis

Type this to check the status of Redis:

sudo systemctl status redis-server

This command should give you the following output:

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 Sat 2019-03-21 15:12:03 PST; 39s ago

Main PID: 2157 (redis-server)

CGroup: /system.slice/redis.service

        └─2157 /usr/bin/redis-server

If you receive the output mentioned above, it means you have completed one process of installation. Now it's time to move on to the next step.

Binding Redis

Redis is not accessible by other hosts because of the default feature. You need to bound it to the localhost ( You have to take the following steps.

Open the Redis configuration file by typing:

sudo nano /etc/redis.conf

Bind it by removing the hash from the beginning:


Now replace your IP address with the server:


Pressing CTRL+x will save the commands and close the interface.

Restart Redis and type this command:

sudo systemctl restart redis-server

Now run the below command to make the confirmation for changes:

tcp        0      0*               LISTEN      14222/redis-server 

tcp6       0      0           *:*               LISTEN      14222/redis-server 

Setup FirewallD form remote host by:

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

Now it’s time to open port 6379 permanently:

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

Replace your client IP address with the machine by giving the following command:

sudo firewall-cmd --zone=redis --add-source=YOUR_CLIENT_IP_ADDRESS –permanent

Reload the firewall and confirm the effect of changes by typing:

sudo firewall-cmd –reload

To confirm everything has gone as planned, type the following commands:


Redis shell will open before you, and to confirm the authenticity, type the following word:


You must see this exact output after the previous command:


If you receive the output mentioned above, now it's time to exit the redis-cli shel by using this command:


Testing Using Redis-client

Run Redis-cli to start testing by typing:


In order to find out the authentic execution, first of all, store a value with the key myname to store value, John use the following command:

set myname "John"

You must see the following output:


Now to fetch the value of myname, run the following command:

get myname

In response, you must have the following output:


It is time to exit the Redis-cli by typing:


Configure Redis Authentication

Configure Redis Authentication to require AUTH before client can make any processing:



requirepass StrongPassword

Set Persistent Store for Recovery

Change the appendonlyvalue to yes by:

appendonly yes

appendfilename "appendonly.aof"

Restart Redis service:

sudo systemctl restart redis

For active firewalld service, allow port 6379:

sudo firewall-cmd --add-port=6379/tcp --permanenent

sudo firewall-cmd –reload

Check redis service status:

$ sudo systemctl status redis

You will have the following output:

  • 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 Sat 2018-12-29 10:11:56 EAT; 9s ago

   Process: 30485 ExecStop=/usr/libexec/redis-shutdown (code=exited, status=0/SUCCESS)

  Main PID: 30500 (redis-server)

     Tasks: 4 (limit: 11510)

    Memory: 6.4M

    CGroup: /system.slice/redis.service

            └─30500 /usr/bin/redis-server

 Dec 29 10:11:56 rhel8.local systemd[1]: Stopped Redis persistent key-value database.

 Dec 29 10:11:56 rhel8.local systemd[1]: Starting Redis persistent key-value database…

 Dec 29 10:11:56 rhel8.local systemd[1]: Started Redis persistent key-value database.

Connect to Redis

Confirm your local connectivity by:

$ redis-cli> INFO

 NOAUTH Authentication required.

Test authenticate:> AUTH

If everything is fine, you will have the following output:


Check Redis information.>  INFO

You will see the following output:> INFO Server







 os:Linux 4.18.0-32.el8.x86_64 x86_64














For 10 parallel connections, for a total of 100k requests:

# redis-benchmark -h -p 6379 -n 100000 -c 10

The screen would show this entire result:

# redis-benchmark -h -p 6379 -n 100000 -c 10


100.00% <= 0 milliseconds

 85470.09 requests per second

 ====== LRANGE_500 (first 450 elements) ======

   100000 requests completed in 1.17 seconds

   10 parallel clients

   3 bytes payload

   keep alive: 1

 100.00% <= 0 milliseconds

 85397.09 requests per second

 ====== LRANGE_600 (first 600 elements) ======

   100000 requests completed in 1.18 seconds

   10 parallel clients

   3 bytes payload

   keep alive: 1

 100.00% <= 0 milliseconds

 84530.86 requests per second

 ====== MSET (10 keys) ======

   100000 requests completed in 1.18 seconds

   10 parallel clients

   3 bytes payload

   keep alive: 1

 100.00% <= 0 milliseconds

 84961.77 requests per second

To show connected clients, use:> client list

The result would be:

id=185 addr= fd=8 name= age=75 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=client

How to perform Redis Benchmark

Built-in tool the Redis-benchmark allows you to see system’s performance statistics. You can have access to data transfer rate, throughput or latency are a few capabilities form a long list of possibilities.

Some of the command options are as follow:


  • Defines the number of requests
  • The default is 100000


  • Defines the number of parallel connections
  • The default value is 50


  • Redis port
  • Which by default is 6379


  • Used to define the host
  • The default value is set to localhost (


  • Accustomed to prompt for a password
  • If the server needs authentication


  • Stands for quiet mode
  • Displays the number of average requests made per second


  • Used to run a combination of tests


  • Used for pipelining
  • Also, for enhanced performance


  • Specifies the data size
  • Bytes for getting and SET values
  • By default, this is set to 3 bytes


Congratulation, you have successfully installed and configured Redis on CentOS 8. If you find any difficulty in installation contact our support team.

If you are looking for a dedicated server, click here and get the best price and features which you can imagine on the internet.

Susith Nonis

I'm fascinated by the IT world and how the 1's and 0's work. While I veture into the world of Technology I try to share what I know in the simplest way possible. Not a fan of coffee, a sweet addict and a self accredited 'master chef'.