How to Install Redis Server on CentOS 8 (Step by Step Tutorial)

How to Install Redis Server on CentOS 8.  When you are looking out for memory that should store all the types of data structures, the first thing that comes to our mind is “Redis server”. Redis server is often referred to as a data structure server and is commonly used to maintain distributed databases.

What is a Redis Server?

install redis server centos 8

Redis stands for remote dictionary server, and it is fast, open source, in memory data structure stored, and key value data (object) storage. Nowadays Redis server is a popular choice because of its fast performance, its powerful caching capacity, effective session management, real time data analytics, geo spatial, gaming, leader boards, chatting or messaging, mailing, media streaming, and publication/subscription applications. Redis is considered highly to distribute relational databases, and various data structures such as strings, lists, maps (locators), sorted data sets, Hyper log files, bitmaps, and data streaming.

There are three features that make Redis a popular tool, they are:

  • Redis server is capable enough to hold the entire database in the memory with the help of a disk.
  • Redis server consists of rich data sets when compared to another kind of key value memory storage.
  • Redis enables to replicate the data to “n” number of data slaves.

Features of Redis Server

  • Offers versatile data structure
  • Data transactions
  • Keys with real time value (used for live connections)
  • Offers LRU evictions of the keys.
  • Clusters and automatic fly over.
  • Supports various programming languages like Python, C, C++, Javascript, Node.JS, Ruby, R, and many others.

Benefits of Redis Server

Redis server allows users to store key value pairs as large as 512MB: This is one of the main advantages of the Redis server, as it allows us to store key and value pairs up to 512MB of data storage. This means the memory storage capacity can exceed up to 1GB.

Redis server makes use of its own hashing mechanism popularly known as “Redis hashing”: Redis server stores the data in the form of a key and a map (that is commonly in the form of string key and string value).

Redis server offers data replication functionality: Data replication is nothing but a process that helps us to set up the master slave cache nodes. The slave node is a replication of the master and works accordingly. For example: if you update the master data, the cache nodes will be updated automatically.

The Redis server cache is able to withstand failure and offers uninterpreted services: The Redis server can be used to set up efficient replications at any point in time. Suppose any of the slave nodes are down, and the cache service will be up and running. This means that the nodes are capable enough to overcome the failure and never stop providing services.

Redis server has a client with respect to all the programming languages: In the beginning, only we have learned that Redis has both client and server applications that are developed in the form of API calls, these API call responses can be written in all the popular programming languages such as C, Ruby, Java, Javascript, Ajax query, Python, and R.

Redis server offers a pub/sub kind of messaging system: With the help of the Redis server, you can develop high performing messaging applications to develop pub/sub mechanisms.

Redis allows to insert huge amount of data into the cache very easily: Sometimes, there will be the requirement to insert millions of data into the cache machine within a given period of time. This process can be done easily with the help of mass data insertion.

You can install Redis server in Rasberry pi and ARM devices: Redis server holds small memory footprints, so it is very easy to install in Rasberry pi and ARM devices (or IoT applications).

Redis protocol makes it simpler to implement a client:  A Redis client is able to communicate with its server with the help of RESP (Redis serialization protocol), and this RESP protocol is simple to implement.

In this post, we will show you how to install the Redis server on CentOS 8.

Install Redis on CentOS 8

By default, the latest version of Redis is included in the CentoS 8 AppStream repository. You can install it easily using the following command:

					dnf install redis -y

Once the Redis is installed, start and enable the Redis service with the following command:

					systemctl start redis
systemctl enable redis

You can now verify the status of the Redis using the following command:

					systemctl status redis

You will get the following output:

					● redis.service - Redis persistent key-value database
Loaded: loaded (/usr/lib/systemd/system/redis.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/redis.service.d
Active: active (running) since Thu 2022-02-10 17:01:26 UTC; 6s ago
Main PID: 4845 (redis-server)
Tasks: 4 (limit: 11411)
Memory: 6.5M
CGroup: /system.slice/redis.service
└─4845 /usr/bin/redis-server

Feb 10 17:01:26 centos8 systemd[1]: Starting Redis persistent key-value database...
Feb 10 17:01:26 centos8 systemd[1]: Started Redis persistent key-value database.


You can also get detailed information of the Redis package using the following command:

					rpm -qi redis

You will get the following output:

					Name : redis
Version : 5.0.3
Release : 5.module+el8.5.0+657+2674830e
Architecture: x86_64
Install Date: Thursday 10 February 2022 05:01:20 PM UTC
Group : Unspecified
Size : 3375001
License : BSD and MIT
Signature : RSA/SHA256, Wednesday 20 October 2021 08:42:03 PM UTC, Key ID 15af5dac6d745a60
Source RPM : redis-5.0.3-5.module+el8.5.0+657+2674830e.src.rpm
Build Date : Wednesday 20 October 2021 08:32:52 PM UTC
Build Host :
Relocations : (not relocatable)
Packager :
Vendor : Rocky
Summary : A persistent key-value database


By default, Redis listens on port 6379. You can check the listening port using the following command:

					ss -antpl | grep redis

You will get the following output:

					LISTEN 0 128* users:(("redis-server",pid=4845,fd=6))

Configure Redis for Remote Access

By default, Redis is configured to connect only from the localhost. If your application is hosted on the other server then you will need to configure Redis to allow the remote connection.

You can do it by editing the Redis configuration file:

					nano /etc/redis.conf

Find the following line:


And, replaced it with the following line:


Save and close the file then restart the Redis service to apply the changes.

					systemctl restart redis

Now, run the Redis CLI command line utility to connect to the Redis.


Once you are connected, you will get the following output:


Now, run the following command to test the Redis:

> ping

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


Next, exit from the Redis shell with the following command:

> exit

Secure Redis Server

By default, Redis is configured to connect without any authentication. For a production environment, it is recommended to enable password authentication to secure the Redis connection.

Edit the Redis configuration file to enable the authentication:

					nano /etc/redis.conf

Change the following line with your secure password:

					requirepass Your_Secure_Password

Save and close the file then restart the Redis service to apply the changes:

					systemctl restart redis

To test the Redis authentication, connect to the Redis shell with the following command:


Now, run the following command to test the connection:

> ping

You will get the following error:

					(error) NOAUTH Authentication required.

The above output indicates that you will need to authenticate Redis before running any command. To authenticate the Redis, run the following command:

> auth Your_Secure_Password

After the successful authentication, you can test the Redis connectivity using the following command:

> ping

You will get the following output:


Finally, exit from the Redis shell using the following command:

> exit

Install Redis Server on CentOS 8 Conclusion

In the above guide, we explained how to install the Redis server on CentOS 8. We also explained how to allow remote connection and secure the Redis server with password authentication. I hope this will help you to set up a Redis server in the production environment.

Avatar for Hitesh Jethva
Hitesh Jethva

I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x