How to Install Redis server 2.8 and higher “latest Redis” on Debian 8/7 “Jessie/Wheezy” Linux systems

undefined

In this mini post I’ll show you how to install and configure the latest redis-server on Debian 8/7 Linux systems. Sometimes you need to use a certain version of redis or any of it’s later versions for your apps to work correctly. Here’s I need to install redis-server > 2.8 on a wheezy Debian which not found by default on the default repositories. This specific version of redis is needed by one of ruby gems we use in our apps, so I’ll add additional repository “dotdeb”. Also no harm from adding this repo to a jessie Debian “if needed.

 

Step 1: Add the dotdeb repository to your existing repositories.

  • For Debian 8 “Jessie”

We have to ways to add this repository, either append the following two lines to /etc/apt/sources.list as follow:

# vim /etc/apt/sources.list 

deb http://packages.dotdeb.org jessie all
deb-src http://packages.dotdeb.org jessie all

or create a separate repository file in /etc/apt/sources.list.d/ with name dotdeb.list and add the following two lines to it, as follow:

# vim /etc/apt/sources.list.d/dotdeb.list

deb http://packages.dotdeb.org jessie all
deb-src http://packages.dotdeb.org jessie all
  • For Debian 7 “Wheezy”

We have to ways to add this repository, either append the following two lines to /etc/apt/sources.list as follow:

# vim /etc/apt/sources.list 

deb http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all

or create a separate repository file in /etc/apt/sources.list.d/ with name dotdeb.list and add the following two lines to it, as follow:

# vim /etc/apt/sources.list.d/dotdeb.list

deb http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all

Step 2: Fetch and install the GnuPG key.

Here’s we will add the GunPG key for the dotdeb repository, same steps for both Jessie and Wheezy, run the following commands:

# cd /tmp
# wget https://www.dotdeb.org/dotdeb.gpg
# apt-key add dotdeb.gpg
# apt-get update

Step 3: installing redis-server with the latest version.

Now, install the needed/latest redis-server as follow:

# apt-get install redis-server

Here are a few lines that you might want to have a look at in /etc/redis/redis.conf:

If redis is supposed to be reachable only on your localhost, you don’t have to change this, if you want it to listen on one or more IP’s, you can change it for example like this:
bind 127.0.0.1 192.168.54.21

You surely don’t want redis to eat all your server’s RAM, so you can specify limits – also you can define what happens if these limits are reached:
maxmemory 2048mb
maxmemory-policy volatile-lru
The explanations and more configuration parameters are available as comments in the configuration file. However I found the above 2 very useful.

Finally if you have installed 2 redis nodes like explained above, you can define one of them as a read replica – the other one is then implicitly the master, just by adding this line:
slaveof 192.168.54.21 6379
(whereas you specify the IP and the port of the master to connect to)

Basically that’s all if you restart redis, everything should be up & running.
/etc/init.d/redis-server restart

When starting redis, you may see a warning in /var/log/redis/redis-server.log concerning your open-file limit. Redis will lower the value for max-clients if your open-file limit is too low. Depending on your machine, you can raise it by executing:
ulimit -n 16384
Or you can make your changes persistent by adding these 2 lines to /etc/security/limits.conf:
*         soft     nofile      16384
*         hard     nofile      16384
You should reboot afterwards for them to take effect in a permanent manner.

If You Appreciate What We Do Here On Mimastech, You Should Consider:

  1. Stay Connected to: Facebook | Twitter | Google+
  2. Support us via PayPal Donation
  3. Subscribe to our email newsletters.
  4. Tell other sysadmins / friends about Us - Share and Like our posts and services

We are thankful for your never ending support.

Leave a Reply

Your email address will not be published. Required fields are marked *