You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

In this tutorial, we will cover step by step ways to install Redis on CentOS 7. Redis is an Open Source in-memory data structure store. Redis can be used as a database server, as a message broker or for caching data in memory for faster retrieval.  Among the data structures supported by Redis are:

  • Hashes
  • sets with range queries
  • Strings
  • sorted lists
  • Hyperloglogs
  • Bitmaps
  • Geospatial indexes e.t.c

For Ubuntu 18.04 / Debian 9, use:

How to Install Redis on Ubuntu 18.04 / Debian 9

For RHEL 8, use:

Install and Configure Redis Server on RHEL 8 / CentOS 8

How to Install Redis on CentOS 7

In this section, we will look at how to install the latest release of Redis on CentOS 7.

Step 1: Update your CentOS 7

Ensure your system is updated before installing Redis

sudo yum -y update

Step 2: Add REMI repisitory

The latest version of Redis is available on Remi repository, add it by executing the command:

sudo yum -y install

Step 3: Install Redis on CentOS 7

After adding the repository, install latest Redis on CentOS 7 from the repository.

$ sudo yum --enablerepo=remi install redis
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
rabbitmq_rabbitmq-server/x86_64/signature | 836 B 00:00:00
rabbitmq_rabbitmq-server/x86_64/signature | 1.0 kB 00:00:00 !!!
rabbitmq_rabbitmq-server-source/signature | 836 B 00:00:00
rabbitmq_rabbitmq-server-source/signature | 1.0 kB 00:00:00 !!!
Resolving Dependencies
--> Running transaction check
---> Package redis.x86_64 0:5.0.3-1.el7.remi will be installed
--> Finished Dependency Resolution
Dependencies Resolved
Package Arch Version Repository Size
redis x86_64 5.0.3-1.el7.remi remi 919 k
Transaction Summary
Install 1 Package
Total download size: 919 k
Installed size: 3.0 M
Is this ok [y/d/N]: y
Downloading packages:
redis-5.0.3-1.el7.remi.x86_64.rpm | 919 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : redis-5.0.3-1.el7.remi.x86_64 1/1
Verifying : redis-5.0.3-1.el7.remi.x86_64 1/1
redis.x86_64 0:5.0.3-1.el7.remi

Get more package details from:

$ rpm -qi redis 
Name : redis
Version : 5.0.3
Release : 1.el7.remi
Architecture: x86_64
Install Date: Thu 10 Jan 2019 05:02:04 PM EAT
Group : Applications/Databases
Size : 3155665
License : BSD
Signature : DSA/SHA1, Wed 12 Dec 2018 04:44:08 PM EAT, Key ID 004e6f4700f97f56
Source RPM : redis-5.0.3-1.el7.remi.src.rpm
Build Date : Wed 12 Dec 2018 04:42:35 PM EAT
Build Host :
Relocations : (not relocatable)
Packager :
Vendor : Remi Collet
Bug URL :
Summary : A persistent key-value database
Description :
Redis is an 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.
You can run atomic operations on these types, like appending to a string;
incrementing the value in a hash; pushing to a list; computing set
intersection, union and difference; or getting the member with highest
ranking in a sorted set.
In order to achieve its outstanding performance, Redis works with an
in-memory dataset. Depending on your use case, you can persist it either
by dumping the dataset to disk every once in a while, or by appending
each command to a log.
Redis also supports trivial-to-setup master-slave replication, with very
fast non-blocking first synchronization, auto-reconnection on net split
and so forth.
Other features include Transactions, Pub/Sub, Lua scripting, Keys with a
limited time-to-live, and configuration settings to make Redis behave like
a cache.
You can use Redis from most programming languages also.

Step 3: Start Redis Service on CentOS 7

Redis service can be started on CentOS 7 using systemd service manager. Also, enable the service to start on system boot.

sudo systemctl enable --now redis

Step 4: Enable network Listen for Redis Service (Optional)

For network clients to connect to your Redis server, it needs the service to listen on a network IP Address.

Open the file /etc/redis.conf with your favorite text editor

sudo vim /etc/redis.conf

Then change line 61 bind to your server IP:


Configure Redis Authentication – (Optional but recommended)

Configure Redis Authentication for clients to require AUTH <PASSWORD> before processing any other commands.

requirepass  <AuthPassword>


requirepass oobaiY8

Set Persistent Store for Recovery

Set persistence mode by changing the appendonlyvalue to yes

appendonly yes
appendfilename "appendonly.aof"

Restart redis service after making the changes

sudo systemctl restart redis

Check redis service status:

$ sudo systemctl status  redis
● redis.service - Redis persistent key-value database
   Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/redis.service.d
   Active: active (running) since Tue 2018-12-04 15:23:08 UTC; 3s ago
  Process: 3625 ExecStop=/usr/libexec/redis-shutdown (code=exited, status=0/SUCCESS)
 Main PID: 3640 (redis-server)
   CGroup: /system.slice/redis.service
           └─3640 /usr/bin/redis-server

Dec 04 15:23:08 cent-01 systemd[1]: Starting Redis persistent key-value database...
Dec 04 15:23:08 cent-01 systemd[1]: Started Redis persistent key-value database.

You can view the port and IP used by Redis service using the sscommand:

$ sudo ss -tunelp | grep 6379
tcp LISTEN 0 128 *:6379  *:*  users:(("redis-server",pid=28163,fd=4)) uid:995 ino:305

If you have an active firewalld service, allow port 6379

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

Step 5: Test connection to Redis Server

Confirm that you can connect to redis locally:

$ redis-cli>

Test authenticate:> AUTH <AuthPassword>

You should receive OK in the output. If you input a wrong password, Authentication should fail:> AUTH WrongPassword
(error) ERR invalid password

Check redis information.>  INFO

This will output a long list of data. You can limit the output by passing Section as an argument. E.g.> INFO Server
# Server
os:Linux 3.10.0-862.14.4.el7.x86_64 x86_64

Step 6: Perform Redis Benchmarking

Run the benchmark with 15 parallel connections, for a total of 10k requests, against local redis to test its performance.

$ redis-benchmark -h -p 6379 -n 10000 -c 15

# Sample output
====== LRANGE_600 (first 600 elements) ======
  10000 requests completed in 0.15 seconds
  15 parallel clients
  3 bytes payload
  keep alive: 1

100.00% <= 0 milliseconds
67114.09 requests per second

====== MSET (10 keys) ======
  10000 requests completed in 0.15 seconds
  15 parallel clients
  3 bytes payload
  keep alive: 1

100.00% <= 0 milliseconds
66666.66 requests per second

For more options and examples, use:

$ redis-benchmark --help

You have successfully installed Redis on CentOS 7. Our next guide will be on cluster installation of Redis on CentOS 7.

As an appreciation for the content we put out,
we would be thrilled if you support us!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here