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 installation and setup processes of Redis on CentOS 8.

Updated: 05 Mar, 23 by Susith Nonis 12 Min

List of content you will read in this article:

Have you ever wanted to have a database but didn’t want to have to learn SQL? Well, there are databases out there that do not use SQL, such as Redis. Today, we will teach you how to install Redis on CentOS with a few simple steps. Before getting into that, however, let us first explain what Redis is and why you might want to pick it over other similar platforms.


According to Redis's official site, “Redis is an open-source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams. Redis has built-in replication, Lua scripting, LRU eviction, transactions, and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.”


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 that 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 processes, are super-fast making it possible to write and retrieve data like a flash. The cache system is robust and can outrun 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 with 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 Structures that 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. 


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 the Redis 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.

Redis Installation Tutorial

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

Install Yum-utils and 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

Enable this repository by running the following command:

sudo yum-config-manager --enable remi

Now install Redis run give this command:

sudo yum install redis

You will have to start Redis using this command manually:

sudo systemctl start redis

Then enable Redis service with:

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 bind it to the localhost ( To do so, 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 of the following line:

# bind

So that it looks like this:


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 from remote host using:

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 it the following command:

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

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

sudo firewall-cmd –reload

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


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 shell 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". Thus, 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 the 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


Built-in tool the Redis-benchmark allows you to see the system’s performance statistics. You can have access to data transfer rate, throughput or latency are a few capabilities from 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

Perform Redis Benchmarking

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:

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


Congratulations, you have successfully installed and configured Redis on CentOS 8. If you find any difficulty in installation, contact our support team. While SQL-based databases are still the way to go, there are still other options available on the market such as Redis that require absolutely no SQL knowledge. If you found this tutorial useful or have any questions, please leave them in the comment section below.

Susith Nonis

Susith Nonis

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