In this tutorial, we will show you how to install Redis on AlmaLinux 8. For those of you who didn’t know, Redis is an open-source, in-memory, and persistent key-value database/store which stores data as key-value pairs and also doubles up as a message broker. Redis supports a wide array of data structures including sets, lists, hashes, strings, HyperLogLogs and so many more.
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 through the step-by-step installation of the Redis on an AlmaLinux 8. You can follow the same instructions for Rocky Linux.
Install Redis on AlmaLinux 8
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf update sudo dnf install epel-release
Step 2. Installing Redis on AlmaLinux 8.
Redis is now included in CentOS 8 AppStream repository and installing it is a walk in the park. Simply run the command below:
sudo dnf install redis
Once installed, start the Redis server and enable
systemd service in order for the server to start after reboot:
sudo systemctl start redis sudo systemctl enable redis
To verify that Redis has installed successfully, we can run the following command:
Step 3. Configure Redis.
The default installation only allows connections from the localhost or Redis server and blocks any external connections. 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:
Save and close also restart Redis server:
sudo systemctl restart redis
To log in to the Redis shell, run the command:
Connect to a Redis server from a remote host using the
redis-cli command-line client:
$ redis-cli -h redis-hostname_OR_ip-address rhel8-redis:6379> INFO # Server redis_version:4.0.10
Step 4. Configure Firewall.
Open firewall ports to allow Redis incoming traffic:
sudo firewall-cmd --zone=public --permanent --add-service=redis sudo firewall-cmd --reload
Congratulations! You have successfully installed Redis. Thanks for using this tutorial for installing the Redis on your AlmaLinux 8 system. For additional help or useful information, we recommend you check the official Redis website.