We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

How to Install and Configure Redis on Debian

Redis is a in-memory key-value store known for performance and flexibility. In this guide you are going to learn how to install and configure Redis on Debian.

This setup is tested on Google Cloud with an Debian OS, so this setup will work on any cloud services like AWS, Azure or any VPS or dedicated servers.

Prerequisites

  • SSH access to the server.

Step 1: Install Redis

Start by updating the packages to latest version.

sudo apt update

Install Redis using the following command.

sudo apt install redis-server

Once the installation is completed you can check the version of Redis using the following command.

redis-server -v
Output
Redis server v=5.0.7 sha=00000000:0 malloc=jemalloc-5.2.1 bits=64 build=636cde3b5c7a3923

Step 2: Configure Redis as a Service

To get more control over Redis operations it is necessary to configure an init system to manage it as a service.

By default the supervised directive in Redis configuration is set to no which is the one that declares the init system.

Change the value to systemd to use the system init.

Open the configuration file located in /etc/redis/redis.conf.

sudo nano /etc/redis/redis.conf

Make changes to the supervised value to systemd so that it looks like below.

. . .
supervised systemd
. . .

Hit CRTL + X followed by Y and Enter to save and exit the file.

Restart Redis for the changes to take effect.

sudo systemctl restart redis.service

Step 3: Check Redis Status

Check Redis status using the systemctl command after the service is restarted.

sudo systemctl status redis

You will receive an output similar to the one below which indicates Redis is working fine.

Output
● redis-server.service - Advanced key-value store
     Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabl>
     Active: active (running) since Tue 2021-09-14 13:24:43 UTC; 1h 32min ago
       Docs: http://redis.io/documentation,
             man:redis-server(1)
   Main PID: 2354 (redis-server)
      Tasks: 4 (limit: 19198)
     Memory: 1.8M
     CGroup: /system.slice/redis-server.service
             └─2354 /usr/bin/redis-server 127.0.0.1:6379

Now Redis will get started automatically every time the system boots up.

If you wish to start up Redis manually for some use cases you can disable the service using the following command.

sudo systemctl disable redis

That’s it. Now you have your Redis server running on your Debian.

Conclusion

Now you have learned how to install and configure Redis server on Debian.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Cart

Your Cart is Empty

Back To Shop