How to install Redis on Debian 11

Redis is derived from the “Remote Dictionary Server”, which is a NoSQL database used to store the data of the websites in the form of key values by following the BSON model. As it is discussed, it stores data in key values, moreover, it also sorts the data in an organized order. In this write-up, we will discuss the installation and configuration of Redis on Debian 11 which is the latest distribution of Linux and also known as Debian Bullseye.

How to install Redis on Debian 11

Before proceeding with the installation procedure of Redis, it is recommended to update the repository of Debian 11 using the command:

$ sudo apt update

Once the package is up to date, we will install Redis by executing the command:

$ sudo apt install redis-server -y

Once the package is installed, we will check the status of it by using the systemctl command:

$ sudo systemctl status redis-server

The output is showing the Redis is installed successfully as well as it is running.

How to configure Redis on Debian 11

To edit the configuration settings of Redis on Debian 11, we will open the configuration file which is present at the path /etc/redis/redis.conf with the help of nano editor.

$ sudo nano /etc/redis/redis.conf

A configuration file will be displayed like this:

The now first step is to allow remote access, for this find out the line having “bind 127.0.0.1: : 1” and just comment it by putting a hash symbol “#” in start:

For security purposes, update the port to 6379 as shown:

Lastly, increase the memory of the server by adding these two lines in the end of the configuration file:

maxmemory 500mb 
maxmemory-policy allkeys-lru

To set the password for the Redis, search for “foobared” as:

Uncomment it and replace the foobared and write anything to set your password, for example, in our case we set it to “itslinux”.

Now exit the editor by pressing CTRL+X, but before it saves the file by pressing CTRL+S. Restart the Redis using the systemctl command:

$ sudo systemctl restart redis-server

Again check the status using the systemctl command:

$ sudo systemctl status redis-server

So the configuration has been done successfully, to connect Redis with Debian run the command:

$ redis-cli

Now to confirm the connection, type:

>ping

It will ask for the password so we now enter the password which is as “itslinux” so execute:

> AUTH itslinux

‘OK’ on the output displayed the connection is successfully established. Now if we want to remove the Redis from Debian 11, we can do so by running the command:

$ sudo apt remove redis-server -y

Conclusion

Redis is an open-source NoSQL database server, which is used to manage the data of the websites in the form of key values in an organized way. In this write-up, we have discussed the installation and configuration procedure of Redis on Debian 11, learned how to set the password of the Redis using the configuration file, and also learned to connect the Redis with Debian with port 6379.

Subscribe to Our Newsletter
Join our Newsletter and get the Linux guide and tips
in your inbox for FREE.