• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

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

July 5, 2015 by Sharad Chhetri

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 : http://redis.io/download

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 - 

or 

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

wget http://download.redis.io/releases/redis-3.0.2.tar.gz

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
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 install_server.sh script.

cd utils
./install_server.sh

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]# ./install_server.sh
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 .

redis-cli

See below given reference.

[root@localhost ~]# redis-cli 
127.0.0.1:6379> 
127.0.0.1:6379> 
127.0.0.1:6379> 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 ~]#

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. How to install redis server on CentOS 7 / RHEL 7
  2. How to install nginx webserver from source on CentOS and RHEL
  3. jemalloc/jemalloc.h: No such file or directory – Redis
  4. How to install nginx from source on CentOS 7
  5. How to install Nagios 4 from source on Ubuntu 14.04 LTS
  6. Install Nginx from source code on Ubuntu 14.04 LTS
  7. Install Cacti from source on Ubuntu 14.04 LTS Server
  8. Install osTicket ( Open source ticketing tool ) on Ubuntu 14.04 LTS
  9. The best Linux and Open Source Magazine from India
  10. Remove python module installed from source code on Linux

Filed Under: Linux Tagged With: redis

Reader Interactions

Comments

  1. Bienvenido David says

    July 26, 2019 at 1:26 am

    We needed to install old Redis on an old server. This worked perfectly!

  2. Crash says

    December 11, 2018 at 10:51 pm

    This is amazing, I just have one question, how do I get out of the Redis server?

    • Sharad Chhetri says

      December 12, 2018 at 3:23 pm

      Hi Crash,

      Thank you for commenting. Type exit to come out from redis cli terminal. We have already written in post inside pre tags.

      Regards
      Sharad

  3. Ahmet Arif Aydin says

    October 9, 2015 at 4:26 am

    Thank you very much for preparing this great tutorial…
    Amazing work !!

    • sharad chhetri says

      October 18, 2015 at 9:27 am

      You are welcome Ahmet,

      Regards
      Sharad

  4. karlos (@nema100) says

    September 17, 2015 at 3:45 pm

    This article helped immensely in getting Redis running on a Centos distro! Very thorough!

  5. Matt Rideout says

    August 30, 2015 at 2:52 pm

    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.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

Allow wget and yum in iptable

Set GRUB password after installation of CentOS/Red Hat

rsync all files,hidden files,symlinks,hardlinks to remotes Linux Server

Nagios HTTP WARNING: HTTP/1.1 403 Forbidden

Could not find make anywhere!!! Please edit the config section to include the path to make. at ./install.pl line 2101

Protect from w00tw00t.at.blackhats.romanian.anti-sec

Non interactive ,without typing password do ssh to Server : By sshpass

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy