Install redis 3.0 from source on Ubuntu 14.04 / CentOS 7 / RHEL 7

In this tutorial we will learn, how to install redis 3.0 from source on Ubuntu 14.04 / CentOS 7 / RHEL 7. In our previous post we wrote tutorial on, install redis on CentOS 7 with yum command . Redis is a an Open Source advanced key-value cache and store . To know more about Redis Server, we highly recommend to read its introduction .

Redis Defualt port number : 6379

Redis Source Package Version : Redis 3.0.2 Stable Version (Release Notes)
Redis Download URL :

What’s new in Redis 3.0 compared to Redis 2.8?

1. Redis Cluster: a distributed implementation of a subset of Redis.
2. New “embedded string” object encoding resulting in less cache misses. Big speed gain under certain work loads.
3. AOF child -> parent final data transmission to minimize latency due to “last write” during AOF rewrites.
4. Much improved LRU approximation algorithm for keys eviction.
5. WAIT command to block waiting for a write to be transmitted to
the specified number of slaves.
6. MIGRATE connection caching. Much faster keys migraitons.
7. MIGRATE new options COPY and REPLACE.
8. CLIENT PAUSE command: stop processing client requests for a specified amount of time.
9. BITCOUNT performance improvements.
10. CONFIG SET accepts memory values in different units (for example you can use “CONFIG SET maxmemory 1gb”).
11. Redis log format slightly changed reporting in each line the role of the instance (master/slave) or if it’s a saving child log.
12. INCR performance improvements.

Install Redis 3.0 On Ubuntu 14.04 / CentOS 7 / RHEL 7

Let’s quickly start the installation of Redis Server from source on Ubuntu/CentOS/Debian/RHEL .
You can follow the given below steps in Ubuntu/CentOS/RHEL as per defined commands.
Note: yum command is used in RHEL/CentOS and apt-get command used in Ubuntu/Debian .

Install prerequisite for Redis

Make and GCC packages are used for compiling the source package. Whereas, we are installing wget for downloading the redis source package.

In CentOS 7 / RHEL 7

yum install make gcc wget

In Ubuntu

sudo apt-get update
sudo apt-get install install make gcc wget

SPECIAL NOTE TO UBUNTU USER : Login as super user and follow the below given steps. To become superuser, use the below given command .

sudo su - 


su -

Download Redis 3 stable Source package

Use wget command to download the stable release Redis 3.0.2 . We recommend you to always install stable release, which you can search in Redis Download URL


Untar downloaded Redis Tar ball

Use the tar command to extract out the Redis from the downloaded tarball file.

tar -xvzf redis-3.0.2.tar.gz

Compiling of Redis from source

Once you extract the Redis Package from tarball, you will get the Redis directory.
In our case, we got directory with name called redis-3.0.2 .

Change to extracted out redis directory. Now you will do most of the command activity inside redis package directory ( i.e redis-3.0.2)

cd redis-3.0.2

Now compiling the dependencies of Redis , available inside extracted out redis directory.

cd deps
make hiredis lua jemalloc linenoise

Once the dependencies are compiled, now start compiling the redis. For this you have to change to one level back. Means go back to Redis installation directory.

cd ..
make install

The redis server is installed only with binaries in your system. In next section we will install init script.

Install init script

In this section we will install init script to manage the process of Redis.
You can use this method in CentOS 7/ RHEL 7 / Ubuntu 14.04 .

I hope you are still inside the Redis installation Directory. Inside the directory you will see utils directory . We have to change to utils directory and run the script.

cd utils

Now you script will ask some question. When you hit only ENTER, the system will take default value or answer.

Given below is reference from our server.

[root@localhost redis-3.0.2]# cd utils/
[root@localhost utils]# ./
Welcome to the redis service installer
This script will help you easily set up a running redis server

Please select the redis port for this instance: [6379] 
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf] 
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log] 
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379] 
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/bin/redis-server] 
Selected config:
Port           : 6379
Config file    : /etc/redis/6379.conf
Log file       : /var/log/redis_6379.log
Data dir       : /var/lib/redis/6379
Executable     : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
[root@localhost utils]# 

Redis start/stop/restart/status

Once the all above steps are done, we can start/stop/restart the Redis Server and also check its status.

In CentOS 7 / RHEL 7

## To check status of Redis Server
systemctl stop redis_6379

## To start Redis Server
systemctl start redis_6379

## To stop Redis Server
systemctl stop redis_6379

## To restart the Redis Server
systemctl restart redis_6379

In Ubuntu

## To check the status Redis Server
service redis_6379 status

## To start Redis Server
service redis_6379 start

## To stop Redis Server
service redis_6379 stop

## To restart Redis Server
service redis_6379 restart

Login into Redis Server

To login into redis server is quite easy. The command is applicable in CentOS 7/RHEL 7/ Ubuntu (as per this post, we only only selected these 3 Operating system)

Use below given command to login into redis server from localhost .


See below given reference.

[root@localhost ~]# redis-cli>>> exit
[root@localhost ~]#

To check help of redis-cli command.

redis-cli --help

Check listening ports by redis

Use ss command to find the listening port.

ss -tanp|grep 6379

Given below is reference,

[root@localhost ~]# ss -tanp|grep 6379
LISTEN     0      128                       *:6379                     *:*      users:(("redis-server",8032,5))
LISTEN     0      128                      :::6379                    :::*      users:(("redis-server",8032,4))
[root@localhost ~]#

7 thoughts on “Install redis 3.0 from source on Ubuntu 14.04 / CentOS 7 / RHEL 7”

  1. Great tutorial! In the “Redis start/stop/restart/status” section, I think you meant to put “systemctl status redis_6379”, instead of “systemctl stop redis_6379” to check the status of the Redis server.

Comments are closed.