How to Install and Configure Redis 6.0 on Debian 11

Redis is a free, and open-source in-memory data structure store used as a message broker and database cache. You can use it with streaming solutions such as Apache Kafka to process, and analyze real-time data with sub-millisecond latency. Redis supports a lot of data structures including, Hashes, Strings, Hyperloglogs, Bitmaps, Geospatial indexes, sorted lists, and more. It is popular due to its wide language support, high availability, and automatic partitioning.

In this post, we will show you how to install and configure Redis 6 on Debian 11.


  • A server running Debian 11.
  • A root password is configured on the server.

Install Redis 6 on Debian 11

The latest version of Redis is not included in the Debian 11 default repository. So you will need to install it from the Redis official repository.

First, install all the required dependencies using the following command:

apt-get install wget curl gnupg -y

Next, download and add the GPG key using the following command:

curl | apt-key add -

Next, add the Redis official repository using the following command:

echo "deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list

Next, update the repository cache and install the Redis using the following command:

apt-get update -y
apt-get install redis-server -y

Once the Redis is installed, verify the Redis installation using the following command:

apt-cache policy redis-server

You should see the Redis package information in the following output:

  Installed: 6:6.2.6-3rl1~bullseye1
  Candidate: 6:6.2.6-3rl1~bullseye1
  Version table:
 *** 6:6.2.6-3rl1~bullseye1 500
        500 bullseye/main amd64 Packages
        100 /var/lib/dpkg/status
     6:6.0.16-3rl1~bullseye1 500
        500 bullseye/main amd64 Packages
     5:6.0.16-1+deb11u1 500
        500 bullseye-security/updates/main amd64 Packages
     5:6.0.15-1 500
        500 bullseye/main amd64 Packages

Manage Redis Service

You can manage the Redis service using the systemd.

To start the Redis service, run the following command:

systemctl start redis-server

To enable the Redis service to start at system reboot, run the following command:

systemctl enable redis-server

To check the status of the Redis service, run the following command:

systemctl status redis-server

You should see the following output:

? redis-server.service - Advanced key-value store
     Loaded: loaded (/lib/systemd/system/redis-server.service; disabled; vendor preset: enabled)
     Active: active (running) since Sun 2021-11-28 07:15:00 UTC; 19s ago
   Main PID: 9079 (redis-server)
     Status: "Ready to accept connections"
      Tasks: 5 (limit: 4679)
     Memory: 7.2M
        CPU: 82ms
     CGroup: /system.slice/redis-server.service
             ??9079 /usr/bin/redis-server

Nov 28 07:15:00 debian11 systemd[1]: Starting Advanced key-value store...
Nov 28 07:15:00 debian11 systemd[1]: Started Advanced key-value store.

By default, Redis listens on port 6379. You can check it with the following command:

ss -antpl | grep redis

You will get the following output:

LISTEN 0      511*    users:(("redis-server",pid=9079,fd=6))
LISTEN 0      511            [::1]:6379         [::]:*    users:(("redis-server",pid=9079,fd=7))

Once you are finished, you can proceed to the next step.

Configure Redis

By default, Redis listens to the localhost. If you want to connect Redis from the remote host then you will need to allow Redis for the remote connection.

To do so, edit the Redis configuration file using your favorite editor:

nano /etc/redis/redis.conf

Comment out the following line:

#bind -::1

Next, set the Redis password as shown below:

requirepass securepassword

Next, change the following line:

appendonly yes
appendfilename "appendonly.aof"

Save and close the file then restart the Redis service to apply the changes:

systemctl restart redis-server

Once you are finished, you can proceed to the next step.

Connect to Redis Instance

You can use the redis-cli command-line utility to connect the Redis server from the local or remote machine.

Run the following command to connect to the Redis instance:


Once you are connected, you will get the following shell:>

Now, authenticate Redis using the password as shown below:> auth securepassword

Next, check the server using the following command:> INFO Server

You will get the following information:

# Server
os:Linux 5.10.0-8-amd64 x86_64

Now, exit from the Redis instance using the following command:> exit

It is recommended to benchmark the Redis to test its performance.

Run the following command to test the Redis with 10 parallel connections, for a total of 2k requests:

redis-benchmark -h -p 6379 -n 2000 -c 10 -a securepassword

You will get the following output:

====== PING_INLINE ======                                         
  2000 requests completed in 0.05 seconds
  10 parallel clients
  3 bytes payload
  keep alive: 1
  host configuration "save": 3600 1 300 100 60 10000
  host configuration "appendonly": no
  multi-thread: no

Latency by percentile distribution:
0.000% <= 0.071 milliseconds (cumulative count 1)
50.000% <= 0.159 milliseconds (cumulative count 1090)
75.000% <= 0.207 milliseconds (cumulative count 1507)
87.500% <= 0.303 milliseconds (cumulative count 1769)
93.750% <= 0.359 milliseconds (cumulative count 1880)
96.875% <= 0.415 milliseconds (cumulative count 1942)
98.438% <= 0.455 milliseconds (cumulative count 1971)
99.219% <= 0.495 milliseconds (cumulative count 1985)
99.609% <= 0.791 milliseconds (cumulative count 1993)
99.805% <= 0.919 milliseconds (cumulative count 1997)
99.902% <= 1.031 milliseconds (cumulative count 1999)
99.951% <= 1.103 milliseconds (cumulative count 2000)
100.000% <= 1.103 milliseconds (cumulative count 2000)

  throughput summary: 35714.29 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
        0.239     0.096     0.231     0.343     0.439     0.727

For more command-line options, run the following command:

redis-benchmark --help


In the above post, we explained how to install and configure Redis 6 on Debian 11 server. You can now implement Redis in a production environment and use it as a message broker or for caching data in memory for faster retrieval. Feel free to ask me if you have any questions.

Share this page:

0 Comment(s)