Install Redis from Source on Debian 10

Updated on August 12, 2020
Install Redis from Source on Debian 10 header image

Redis is an in-memory data structure store used as a database, message broker, and cache. It implements a distributed key-value store system. It supports many kinds of data structures. In this tutorial, we will build Redis from source on Debian 10.


1. Install Dependencies

Build tools

To build Redis, we need build tools like compilers and make. Debian bundles these packages in the build-essential metapackage. We also need the pkg-config package. To install these dependencies, run

# apt install pkg-config build-essential -y


Git is a source control tool that will be used to retrieve the source code from the repository. Install it with the following command.

# apt install git -y

2. Install Redis

First, you must choose which version of Redis you are going to install. You can select the latest (unstable) version directly from Git, or you can get old versioned stable release.

Create the install directory

First, we will change directories to /opt (and create it in case it does not exist), a place to store software not installed through the package manager.

# mkdir /opt
# cd /opt

Select Version to Install


To get the very latest Redis from git (unstable):

# git clone

Change directories to the folder.

# cd redis


To get the latest stable, find the link at the Redis download page. As of this writing, the latest stable Redis is 6.0.5.

# wget

Extract the compressed archive (adjusting the version number to the version you downloaded).

# tar xf redis-6.0.5.tar.gz

Change directories to the folder.

# cd redis-6.0.5

Build Redis

Redis uses a Makefile build system. Build it with the following command.

# make

Install it:

# make install

3. Using Redis

We will now demonstrate some of Redis's features. Start a Redis server in the background (daemonized):

# redis-server --daemonize yes

Now, connect to the server with redis-cli:

# redis-cli

Test Connectivity

The client's connectivity can be tested with the ping command.> ping

You should see in response:


Assign a Value to a Key

Test assigning a value to a key with the following command.> set test "redis works"

You should see in response:


Retrieve the value of the key.> get test

You should see in response:

"redis works"

Exit redis-cli

Use the exit command to exit the Redis CLI interface.> exit


Congratulations, you have now built from source and tested Redis on a Debian 10 Vultr instance.