NOTE: This demo is done on Debian 11 running on WSL (windows subsystem for linux). Slight variations may be needed on Debian 11 running on other cloud or virtualization platforms or natively on bare metal.
Update Debian 11 System First
Running the following commands in your terminal to make sure your system is ready for installation:
$ sudo apt upgrade
Install Redis on Debian 11
Now install Redis Server package which will also include client packages
Start Redis Server
You can now manually start a Redis daemon with redis-server command. Also you can verify it is started with ps command:
$ ps -ef | grep redis
Interact with Redis using the redis-cli
Test your redis instance locally using the redis-cli utility. Enter the interactive shell and insert a couple key values, print the key count and fetch a value from a key. Then delete everything with flushall. Here is the code:
Enter the redis-cli:
Insert a couple keys and then get the key count
127.0.0.1:6379> set f2 "banana"
127.0.0.1:6379> set f3 "orange"
127.0.0.1:6379> DBSIZE
Fetch the value of key “f3” and then delete all keys and verify key count:
127.0.0.1:6379> FLUSHALL
127.0.0.1:6379> DBSIZE
Conclusion of Installation of Redis
Redis is installed now on Debian 11, using these sample steps. This is good enough for testing and developing with Redis. For production usage of Redis, best practices would be to ensure Redis daemon is supervised using the normal system init scripts. You can see options for this in the redis configuration file and check other tutorials on how to ensure Redis is auto-started and monitored in your system.