In this tutorial we’ll learn how to install Redis on CentOS 7. We will also install and configure its prerequisites. Redis is an open source multi-platform data store written in ANSI C, that uses datasets straight from memory achieving very high performance. It supports different programming languages, including Lua, C, Java, Python, Perl, PHP and many others. It’s founded on ease, about 30k lines of code which do “few” things, but do them well. Despite you work on memory, persistence can exist and it has a fairly decent support for high availability and clustering, which does great in keeping your data secure.
I recommend to use a minimal CentOS server setup as a basis for the tutorial, that can be a virtual or a root server image with an CentOS 7 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install Redis on CentOS 7
Step 1. First, ensure your system is fully up-to-date by running the following:
yum -y update
Step 2. Installing Redis.
First, We need to install the EPEL (Extra Packages for Enterprise Linux) repo in order to fetch the Redis packages:
yum install epel-release
Now weâll install the Redis server package:
yum -y update yum install redis
Once the installation process has finished, starting the Redis service is done by entering the following command:
sudo systemctl start redis.service sudo systemctl enable redis.service
Verify that Redis is running with redis-cli:
If you get a PONG response, you are ready to move on to the next step in the guide.
Step 3. Configure Redis.
Weâll open up its default configuration file to ensure that Redis is bound to the local IP. Unless you are running a full Redis cluster, which is beyond the scope of this guide, this is the best way to secure your Redis store from unauthorized access:
Search for the line that begins with âbindâ, changing it as follows:
Save your changes and restart the Redis service to reload our configuration changes:
sudo systemctl enable redis.service
Redis should now be operational. To test, weâll connect locally and enter some data:
root@redis-nodes:~# redis-cli 127.0.0.1:6379> set besthost "myvpsource.net" OK 127.0.0.1:6379> get besthost "myvpsource.net"
Congratulation’s! You have successfully install and configure Redis server on your CentOS 7 server. Thanks for using this tutorial for installing Redis on CentOS 7 system.