Installing Redis on Linux

We can install Redis on Linux by using pkg manager (i.e. yum on RHEL). But it is difficult to get the latest version in rpm. So I prefer to install it by compiling latest source code. The following is step by step procedure. (Tested on 4.0.6)

1. To download source code

You can download  the latest source code from

2. To install prerequisites

To compile the source code, you must install gcc and tcl in advance. (tcl is used to test compilation)

3. To compile source code

  1. extract source code
  2. # cd extract_dir
  3. # make
  4. # make test (optional, but recommended. To run it, you must install tcl in advance)
  5. # make install PREFIX=/some/custom/directory
    If PREFIX is not set, default installation path is /usr/local/bin.

4. To set OS parameters

Redis needs some OS parameters to work properly.

Kernel parameters for RHEL or CentOS => /etc/sysctl.conf

  • net.core.netdev_max_backlog = 30000
  • net.core.somaxconn = 4096
  • vm.overcommit_memory = 1

Limit parameters => /etc/security/limits.conf

redis_account              soft    nproc   2047
redis_account              hard    nproc   16384
redis_account              soft    nofile  1024
redis_account              hard    nofile  65536
redis_account              soft    stack   10240

Disable Transparent Huge Pages

Each Linux distribution has different ways to disable THP.

For example, RHEL or CentOS’s way to disable it =>

5. To run it

Redis server executable is INSTALL_DIR/bin/redis-server. You can run it with default options as follows.
# ./redis-server

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.