In this article, we will have explained the necessary steps to install Redis on Debian 11. Before continuing with this tutorial, make sure you are logged in as a user with sudo
privileges. All the commands in this tutorial should be run as a non-root user.
Redis stands as one of the most popular caching tools nowadays. Redis is a free, open-source, cross-platform NoSQL, and in-memory Key-value data structure store, used as a database server, cache, and message broker.
Install Redis on Debian 11
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo apt update sudo apt upgrade
Step 2. Install Redis on the Debian system.
By default, the Redis package is included in the Debian 11 default repository. So to install Redis run the below command:
sudo apt install redis-server
After successfully installing the Redis package, it will start automatically. You can issue the command below to check the status of the Redis service:
sudo systemctl status redis-server
Step 3. Configure Basic Settings for Redis.
Once successfully start the Redis server, you can configure it by editing the file/etc/redis/redis.conf
:
nano /etc/redis/redis.conf
Then change line bind 127.0.0.1
to below:
# line 68 : listening interface # localhost only by default # if you'd like to connect from other Hosts, # hange to the own IP address or set to [0.0.0.0] bind 127.0.0.1 ::1 # line 91 : listening port port 6379 # line 224 : daemonize setting # if you use Redis as service daemon, turn to [yes] daemonize yes # line 275 : number of Databases # database ID is assgined from 0 to (setting value - 1) databases 16 # line 307 : save caching Datase on Disk # the default settings below means like follows # after 900 sec if at least 1 key changed # after 300 sec if at least 10 keys changed # after 60 sec if at least 10000 keys changed # if you'd like to disable this function, comment out all lines fo "save ***" or specify [save ""] save 900 1 save 300 10 save 60 10000 # line 791 : authentication password requirepass password # line 1094 : alternative persistence mode ("yes" means enabled) # if enabled, Redis loses high performance but get more safety appendonly no # line 1123 : if enabled [appendonly yes] when wirting data on Disk # [no] means do not fsync by Redis (just let the OS flush the data) # appendfsync always appendfsync everysec # appendfsync no
Save and close the file when you are finished then restart the Redis service to apply the changes:
sudo systemctl restart redis-server
Step 4. Test Connection to Redis Server
Now run basic Redis commands to test the installation:
redis-cli> ping
Result:
127.0.0.1:6379> ping PONG
That’s all you need to do to install the Redis on Debian (Bullseye). I hope you find this quick tip helpful. For further reading Redis caching data memory on Debian’s system, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.