This tutorial will help you to install the Redis on Debian 11 (Bullseye) Linux system.

Updating System Packages

It’s a good practice to keep packages up to date on your system. You should always update the before beginning any major installations. Issue the command below:

Installing Redis on Debian 11

Redis 6.0 packages are available under the default Bullseye repositories. You can quickly install Redis by using the apt package manager on your Debian Linux system. Once the installation finished successfully, check the Redis service status by the below-mentioned command.

Configuring Redis

You can use Redis with the default settings from the local system. But in case you need to customize the Redis server like allow access from remote hosts, change the default port or increase the memory allocation. Edit the Redis configuration file in a text editor: Now, make the required changes to the Redis server. Below are some quick uses changes in the Redis server.

Change Redis Port: You can run your Redis server to a non-standard port. This is good practice for security purposes. Search for the below section and update the port under at port 6379. # Accept connections on the specified port, default is 6379 (IANA #815344). # If port 0 is specified Redis will not listen on a TCP socket. port 6379123# Accept connections on the specified port, default is 6379 (IANA #815344).# If port 0 is specified Redis will not listen on a TCP socket.port 6379 Allow Remote Connection: Search for bind 127.0.0.1 ::1 line and comment it by adding “#” at start of line. # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES # JUST COMMENT OUT THE FOLLOWING LINE. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # bind 127.0.0.1 ::11234# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES# JUST COMMENT OUT THE FOLLOWING LINE.# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# bind 127.0.0.1 ::1 Change Memory Allocation: Update the following values in Redis configuration file according to your requirement. You can increase max memory limit as per available memory on your server. maxmemory 256mb maxmemory-policy allkeys-lru12maxmemory 256mbmaxmemory-policy allkeys-lru

Make necessary changes and save the file. Then restart the Redis service to apply changes.

Connect to Redis

Type redis-cli on command lien to connect to the Redis server. You will get the Redis server prompt as below. Now type “ping” on the Redis command prompt. On successful connection with the Redis server, you will get PONG as a result.

Conclusion

This tutorial helps you with the installation of the Redis server on the Debian 11 Bullseye Linux system. You can find more details about redis-cli command line tool from its official documentation.

How to Install Redis on Debian 11 Linux   TecAdmin - 13