Install and Configure Redis Server on Rocky Linux 8 / AlmaLinux 8

Install and Configure Redis Server on Rocky Linux 8 / AlmaLinux 8. Redis is an open-source in-memory data structure store that can be used as a NoSQL database, message broker, or cache. It is ideal for applications that frequently handle large amounts of data. This tutorial will explain how to install and configure Redis Server version 5.x on Rocky Linux 8 or AlmaLinux 8.

Before beginning, you will need to have a registered domain name and have configured DNS records pointing to your server’s IP address. You will also need to make sure you have root access or equivalent privileges to install and configure Redis.

Install Redis Server on Rocky Linux 8 / AlmaLinux 8

In the next section we cover all the steps that are required to install and configure Redis Server on Rocky Linux 8 / AlmaLinux 8.

Step 1: Install Redis packages

Let’s begin the process by updating system package list and upgrade any existing packages:

sudo dnf -y update

Redis server and client packages are available on the OS AppStream repository. You can check versions using the commands below:

$ sudo dnf module list redis
Rocky Linux 8 - AppStream
Name                                    Stream                                    Profiles                                        Summary
redis                                   5 [d][e]                                  common [d] [i]                                  Redis persistent key-value database
redis                                   6                                         common [d]                                      Redis persistent key-value database

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

From the output we can see the default version is 5. We need to reset and enable instead.

sudo dnf -y module reset redis
sudo dnf install @redis:6

Accept installation prompts to proceed.

Transaction Summary
Install  1 Package

Total download size: 1.2 M
Installed size: 4.3 M
Is this ok [y/N]: y

After installation of the package, proceed to start and enable redis service to start at boot.

sudo systemctl enable --now redis

Service status should show running.

$ 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 2023-01-16 07:09:09 UTC; 6s ago
 Main PID: 30476 (redis-server)
   Status: "Ready to accept connections"
    Tasks: 5 (limit: 23036)
   Memory: 7.3M
   CGroup: /system.slice/redis.service
           └─30476 /usr/bin/redis-server

Jan 16 07:09:09 systemd[1]: Starting Redis persistent key-value database...
Jan 16 07:09:09 systemd[1]: Started Redis persistent key-value database.

Step 2: Configure Redis Server

Redis Server can be configured by editing the configuration file located at /etc/redis.conf.

Enable Redis Service to listen on all interfaces

By default, Redis service listens on

$ ss -tunelp | grep 6379
tcp   LISTEN  0    128*  users:(("redis-server",pid=30348,fd=6)) uid:986 ino:71091 sk:4 <->    

You can edit to allow the service listen on all network interfaces for remote clients connections.

sudo vim /etc/redis.conf

The line to changed is bind to below:


Restart Redis after making the change using the commands below.

sudo systemctl  restart redis

Confirm if Redis Server is now listening on the new bind address.

$ ss -tunelp | grep 6379 tcp LISTEN 0 128* users:(("redis-server",pid=30348,fd=6)) uid:986 ino:71091 sk:4 <->

Step 3: Configuring Redis Authentication

Configure Redis Authentication for clients to require AUTH <PASSWORD> before processing any other commands. Edit the configuration file using your favorite file editor.

requirepass  <AuthPassword>

Set desired password in requirepass parameter.

requirepass StrongPassword

Step 4: Setting Persistent Store for Recovery

Set persistence mode by changing the appendonlyvalue to yes

appendonly yes
appendfilename "appendonly.aof"

Restart redis service after making the changes

sudo systemctl restart redis

If you have an active firewalld service, allow port 6379

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

Confirm status of your service after the restart.

systemctl status redis

Step 5: Connect to Redis Server from CLI

An easy way to test Redis server is by running the command redis-cli and pass ping as an argument.

$ redis-cli ping

If you see “PONG” in response, it indicates that Redis server is running and responding to commands. You can also use interactive session.

$ redis-cli> ping
 NOAUTH Authentication required.

Test authentication of Redis.> AUTH <AuthPassword>

You should receive OK in the output. If you input a wrong password, Authentication should fail:> AUTH WrongPassword
(error) ERR invalid password

Check redis information.> INFO

This will output a long list of data. You can limit the output by passing Section as an argument. E.g.> INFO Server
# Server
os:Linux 4.18.0-425.3.1.el8.x86_64 x86_64
monotonic_clock:POSIX clock_gettime

Step 6: Performing Redis Benchmarking

Run the benchmark with 10 parallel connections, for a total of 100k requests, against local redis to test its performance.

# 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 see all possible command options use --help

$ redis-benchmark --help

You can check clients connected to your Redis server using:> client list 
 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

Using Redis with Python

To use redis with Python, install Python Redis Client Library:

sudo yum -y install  python-redis

Using Redis with PHP

To connect to Redis server with PHP, install PHP Redis Client Module.

sudo yum -y install php-redis


We have successfully installed and configured Redis Server 5.x on Rocky Linux 8 or AlmaLinux 8. With Redis, you can store data in an in-memory key-value store and can be used for various applications including caching and message brokering. We hope this guide has been helpful for you in setting up Redis on your systems.

One of the key features of Redis is the ability to handle high-performance data operations in any kind of application. By storing its data in memory, it has faster data access than traditional disk-based databases. This makes Redis an ideal choice for use cases such as real-time analytics, session management, and leaderboards. With Redis support for data clustering you can easily achieve horizontal scaling of the database to handle the increased load by adding extra nodes. This enables Redis server(s) to handle large amounts of data and traffic without losing on the performance aspect.

About Me:I'm the digital marketing specialist, competent in SEO (Google, Yahoo & Bing), Google Adwords (Search, Display, Google Shopping etc.), Facebook & Instagram Advertising etc. I can work in all platforms of digital marketing & advertise the legitimate products/services in a specific country, city or all over the world.

Request a free quote

We offer professional SEO services that help websites increase their organic search score drastically in order to compete for the highest rankings even when it comes to highly competitive keywords.

About us and this blog

We are a digital marketing company with a focus on helping our customers achieve great results across several key areas.

Subscribe to our newsletter!

    Leave a Comment

    No Comments