Step 1: System Update

Before installing Redis, update the system packages:

sudo dnf update -y

Step 2: Installing Redis

Redis is available in the EPEL repository. To install Redis, first add the EPEL repository:

sudo dnf install epel-release -y

After adding EPEL, install Redis with the following command:

sudo dnf install redis -y

Step 3: Configuring Redis

Redis is installed. Now, enable and start it as a service:

sudo systemctl enable redis
sudo systemctl start redis

To check Redis status:

sudo systemctl status redis

Step 4: Configuring for Remote Access (Optional)

If you want Redis to be accessible from other machines, open the configuration file:

sudo nano /etc/redis/redis.conf

Find the line:

bind 127.0.0.1

Replace it with:

bind 0.0.0.0

After that, restart Redis:

sudo systemctl restart redis

Step 5: Opening the Redis Port in Firewall

If your server has a firewall enabled, open port 6379:

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

Verification

To verify the connection to Redis, you can use the client:

redis-cli

Redis is now installed and running on your CentOS 9 server.

Comments:
There are no comments for this post yet.
Log in to leave a comment.