Redis is an open-source in-memory database for storing data structure, caching, and as a message broker. It supports data structures such as strings, lists, sets, hashes, sorted sets with range queries, bitmaps, HyperLogLogs, and geospatial indexes with radius queries. Redis has a built-in replication feature, which makes it work as highly available clusters in your production environments.

Advertisement

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

Step 1: 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:

sudo apt update 
sudo apt upgrade 

Step 2: 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.

sudo apt install redis-server 

Once the installation is finished successfully, check the Redis service status by the below-mentioned command.

sudo systemctl status redis.service 
Redis Server Setup on Debian
Redis Service Status

Step 3: 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 allowing access from remote hosts, changing the default port, or increasing the memory allocation.

Edit the Redis configuration file in a text editor:

sudo nano /etc/redis/redis.conf 

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 port 6379.

  • Allow Remote Connection: Search for bind 127.0.0.1 ::1 line and comment it by adding “#” at start of line.

  • Change Memory Allocation: Update the following values in the Redis configuration file according to your requirement. You can increase the max memory limit as per available memory on your server.

After doing the required changes, save the file. Then restart the Redis service to apply changes.

sudo systemctl restar redis.service 

Step 4: Connect to Redis

Type redis-cli on the command line to connect to the Redis server.

redis-cli 

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.

 ping 
PONG

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 the `redis-cli` command line tool from its official documentation.

Share.

1 Comment

Leave A Reply


Exit mobile version