How to Install Redis on Ubuntu?

Redis called as Remote Dictionary Server. Redis is an Open-Source in-memory data structure server. It is used as cache storage and Database. Redis stores a mapping of keys to five different types of values. Redis is also useful to run task queues in the server background.

Following are the steps to install Redis on Ubuntu Server.

Install Redis Server :

  1. Execute the below command to install Redis.

    # sudo apt-get install redis-server -y
  2. Hit the below command to check that the Radis is working.

    # redis-cli
  3. If the installation is successful, Redis will open a command-line interface. Hit below command to check it is working fine.

    # 127.0.0.1:6379> PING

          If you receive PONG in response, this means Radis is installed properly on your server.

  1. Hit EXIT command to exit from Radis-cli.

    # 127.0.0.1:6379> EXIT

          Let us configure Redis for Memory Usage Limit and Password.

Configure Redis Server :

  1. Redis configuration file will be at “/etc/redis/redis.conf”. Edit the configuration file with your favorite editor, Hit the following command.

    # sudo nano /etc/redis/redis.conf
  2. Hit Ctrl+W Button and find the following line by hitting enter Button.

    # maxmemory 

          change it to 256mb or to the number you required.

# maxmemory 256mb

          

  1. Set the Password for Radis. Hit Ctrl+W and type “# requirepass” and Hit Enter.

     requirepass Your Password
    


  2. Change it to your desired Password.

  3. Type CTRL+X and press Y Button and Hit the Enter key to save the configuration.

  4. Restart the Redis Service to update the configuration we have made in redis.conf file.

    # rsudo service redis restart
    
  5. Check the Redis Status by executing the below command.

    # sudo service redis status
    

          This is it. You are done with Redis installation and configuration.

  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to fix rpmdb failed error while processing cPanel update?

You may face the below error while updating cPanel with upcp command or while updating centos...

How to add user to sudo group in a Linux VPS?

With Sudo you can provide special privileges to any user or group. In Linux, there are few...

How to upgrade Debian 7 (Wheezy) to 10 (Buster) version?

It is always recommended to upgrade the version to prevent any security vulnerability. You can...

Fix Exim error-exim dead but subsys locked

Problem Statement php mail scripts were not working in Linux VPS. Error Message exim dead but...

What are the benefits of CloudLinux?

There are numerous advantages and benefits of CloudLinux OS and we will discuss it in this...