How to Install Redis on Rocky Linux 8

Install Redis on Rocky Linux 8

In this article, we will have explained the necessary steps to install Redis on Rocky Linux 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Redis acronym for Remote dictionary server is a popular and open-source in-memory key-value data store. It supports various data structures such as Hash, Lists, Sets, Strings, and much more.

Install Redis on Rocky Linux 8

Step 1. First, before you start installing any package on your Rocky Linux server, we always recommend making sure that all system packages are updated.

sudo dnf install epel-release
sudo dnf update
sudo dnf upgrade

Step 2. Install Redis on the Rocky Linux system.

Redis version 5.0.x is now included in Rocky Linux 8 AppStream repository. Run the following dnf command to install Redis to your system:

sudo dnf install redis

Once installed, you can verify the version of Redis installed by running the command:

rpm -q redis

To start and enable Redis service, run following systemctl commands below:

sudo systemctl enable redis
sudo systemctl start redis
sudo systemctl status redis

Step 3. Redis Configuration.

By default, Redis only allows the Redis server to localhost (127.0.0.1) connection. We are going to configure Redis for remote connection from a client machine:

sudo nano /etc/redis.conf

Locate the bind parameter and replace 127.0.0.1 with 0.0.0.0:

bind 0.0.0.0

Save and close the configuration file. For the changes to come into effect, restart the Redis service:

sudo systemctl restart redis

Step 4. Configuring Firewall.

Now allow access to the remote connections. First, add the new Redis zone by running the below-mentioned command:

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

Step 5. Verify Redis Installation.

To check the Redis is working correctly, send the ping Redis with the following command below:

redis-cli

Result:

[[email protected] ~]$ redis-cli
127.0.0.1:6379> auth Mei666
OK
127.0.0.1:6379> ping
PONG
127.0.0.1:6379>

That’s all you need to do to install Redis on Rocky Linux 8. I hope you find this quick tip helpful. For further reading on the Redis server, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.