How To Install Redis on Rocky Linux 9

Install Redis on Rocky Linux 9

In this tutorial, we will show you how to install Redis on Rocky Linux 9. For those of you who didn’t know, Redis is an open-source database frequently used as a cache. Unlike other databases, Redis stores data in memory, making it significantly faster. Redis is extensively known for its broad support, high performance, high availability, and flexibility.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Redis cache on Rocky Linux. 9.

Prerequisites

  • A server running one of the following operating systems: Rocky Linux 9.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo useror access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Redis on Rocky Linux 9

Step 1. The first step is to update your system to the latest version of the package list. To do so, run the following commands:

sudo dnf check-update
sudo dnf install dnf-utils
sudo dnf install epel-release

Step 2. Installing Redis on Rocky Linux 9.

By default, Redis is available on Rocky Linux 9 base repository. Now run the following command below to install the latest stable version of Redis to your system:

sudo dnf install redis

Next, start the Redis service and enable it to automatically start on boot by running the following command below:

sudo systemctl enable --now redis
sudo systemctl start redis
sudo systemctl status redis

You can verify the Redis installation by running the following commands:

redis-server --version

Step 3. Configuring Redis.

Redis stores its configuration file at /etc/redis/redis.conf. This file can be edited as desired.

sudo nano /etc/redis/redis.conf

To allow remote access to the redis instance, bind redis to 0.0.0.0 using this line:

bind 0.0.0.0

To set password in redis, use this:

requirepass idr00t1234

To add a pid file to redis:

pidfile /var/run/redis/redis-server.pid

Set Persistent Store for Recovery by changing the appendonlyvalue to yes:

appendonly yes
appendfilename "appendonly.aof"

Once the desired configurations have been made, save the file and restart the service:

sudo systemctl restart redis

To log in to the Redis shell, run the command:

redis-cli

To authenticate:

127.0.0.1:6379> auth idr00t1234
OK

Step 4. Configure Firewall.

Open firewall ports to allow Redis incoming traffic:

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

Congratulations! You have successfully installed Redis. Thanks for using this tutorial for installing the Redis on your Rocky Linux 9 system. For additional help or useful information, we recommend you check the official Redis website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!