AlmaLinuxLinuxTutorials

How To Install Redis on AlmaLinux 8

Install Redis on AlmaLinux 8

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 that 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 the step-by-step installation of the Redis on an AlmaLinux 8. You can follow the same instructions for CentOS and Rocky Linux.

Prerequisites

  • A server running one of the following operating systems: AlmaLinux 8, CentOS 8, or Rocky Linux 8.
  • 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 user or access to the root user. We recommend acting as a non-root sudo user, however, you can harm your system if you’re not careful when acting as the root.

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 been installed successfully, we can run the following command:

redis-cli ping

Output:

PONG

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:

bind 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:

redis-cli

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.

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!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button