How to Install Redis® from Source on Ubuntu and CentOS

Updated on June 22, 2024

Introduction

Redis® is often referred to as a data structures server. This means that Redis® provides access to mutable data structures via a set of commands, which are sent by using a client/server model with TCP sockets. Different processes can query and modify the same data structures in a shared way. (from the official git repo)

Installing Redis®

First, your Linux server must be equipped with git. To install git, use the following command.

For Ubuntu:

apt-get update; apt-get install -y git

For CentOS:

yum update; yum install git

After the installation of the git, download the source code of Redis®.

git clone http://github.com/antirez/redis/

Before compiling the source code, you should have the build-essential package installed.

For Ubuntu:

apt-get install build-essential

For CentOS:

yum groupinstall "Development Tools"

Once this package is installed, make and install Redis®.

sudo make; sudo make install

Using Redis®

Congrats, you now have the Redis® server installed! You can type redis-cli to query/insert data or type redis-benchmark to test out the performance of your VPS.