In this tutorial, we will show you how to install Redis on CentOS 8. For those of you who didn’t know, Redis is an open-source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, and sorted sets. Redis also supports data types such as Transitions, Publish and Subscribe. ‘Redis ’ is considered more powerful than ‘Memcache’. It would be smart to bring ‘Redis’ into practice and put ‘Memcache’ down for a while.
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 Redis on a CentOS 8 server.
Install Redis on CentOS 8
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf update
Step 2. Installing Redis on CentOS.
Install Redis using
sudo dnf install redis
Once the package is installed, start and enable Redis service to start on boot:
sudo systemctl start redis sudo systemctl enable redis
Check Redis server version:
Step 3. Configuring Redis Server on CentOS 8.
You can configure Redis using the
/etc/redis.conf configuration file:
cp /etc/redis.conf /etc/redis.conf.orig
Now open it for editing using your favorite text editing:
Then change line 69 bind 127.0.0.1 to below:
After changes in the Redis configuration file, restart the Redis service to apply the changes:
sudo systemctl restart redis
Step 4. Configure firewalld for Redis.
If you have an active firewalld service, allow port 6379:
firewall-cmd --permanenent --add-port=6379/tcp firewall-cmd --reload
Finally, access the Redis server using the
redis-cli client program:
redis-cli >client list
Congratulations! You have successfully installed Redis. Thanks for using this tutorial for installing the Redis server on CentOS 8 system. For additional help or useful information, we recommend you to check the official Redis website.