Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Databases»How to Install Redis on Debian 11 Linux

    How to Install Redis on Debian 11 Linux

    By RahulJanuary 6, 20233 Mins Read

    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.

      1
      2
      3
      # Accept connections on the specified port, default is 6379 (IANA #815344).
      # If port 0 is specified Redis will not listen on a TCP socket.
      port 6379

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

      1
      2
      3
      4
      # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
      # JUST COMMENT OUT THE FOLLOWING LINE.
      # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # bind 127.0.0.1 ::1

    • 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.

      1
      2
      maxmemory 256mb
      maxmemory-policy allkeys-lru

    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.

    database nosql redis
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Securing MySQL Database with Limited User Permissions

    How to Install and Secure MongoDB on Ubuntu 22.04

    How to Install And Configure Redis on Ubuntu & Debian

    View 1 Comment

    1 Comment

    1. Maxime Michaud on January 5, 2023 7:09 pm

      Hi Rahul,
      sudo systemctl restar redis.service
      ==>
      sudo systemctl restart redis.service

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.