How to Install and Configure Redis on Ubuntu 20.04

By

Redis Server

Similar to Memcached, Redis is in-memory storage and caching framework. It can be used to store all kinds of data in a structured format, from the results of the database to ad hoc data bits, to the actual SQL query. It is possibly most widely used as a shared memory server memory or a caching device with distributed data. Redis is a high-quality software written by a guy who is a brilliant engineer and who knows what he’s talking about. For a lot of very advanced cases, it’s really fine, but that’s not why most people use it. In general, it’s more geek ware than revolutionary technology that will cause a new technology category to grow.

Redis has a large benefit over Memcached and other in-memory caches in that it enables users to store data in a more organized, long-lasting, and secure manner. For example, it enables strong durability options, replication, and something that is not supported by most caching systems. There are also some efficiency advantages.

Redis is also known as a store for data structure and not necessarily a “database”. Its capabilities have expanded dramatically after starting as an in-memory key-value store, but it’s best known for being a lightning-fast store that can hold a variety of data types, especially key-value, lists, and sets.

There are a variety of common use cases for Redis  including:

  1. Rate limiting: Redis is a good candidate for monitoring use and implementing rate-limiting for microservices because it’s fast and simple to do stuff like LRU lists.
  2. Advanced key-value: There exists a variety of ways to use its various features such as assets to store key-value entries by set intersection and select portions.
  3. Caching: Redis is commonly used instead of Memcache for speed and durability. It has built-in support for expiration which is extremely useful in this case.
  4. Queueing: Redis can be used very effectively for basic queueing-type operations since Redis offers sorted-list features, like push/pop.
  5. Redis has extended its capabilities to embrace items such as streaming, geospatial support, data from time series, and much more. It’s also set up to develop with its modules capability and also it’s very simple to set up and begin working with Redis with managed offerings in both AWS and Google Cloud.

Now, let’s step-in towards the Redis Installation process on Ubuntu 20.04. Before following the installation guide, make sure that you are working as a ‘superuser’.

Installing and Configuring Redis on Ubuntu 20.04

Step 1: Open the terminal by pressing ‘CTRL+ALT+T’ or search it in the activities. The package list needs to be updated.

$ sudo apt-get update

Step 2: Write-out the following command to install Redis Server on your system.

$ sudo apt install redis-server
$ sudo systemctl status redis-server

Step 3:  Open the configuration file of Redis and comment the line as shown in the output.

$ sudo nano /etc/redis/redis.conf

Step 4: Now, utilize the given command to restart the Redis-server.

$ sudo systemctl restart redis-server

Step 5: Confirm that Redis-Server is working and listening to all ports.

$ ss -an | grep 6379

You can also specify the IP address you want to run for your Redis server.

$ sudo ufw allow proto tcp from 192.168.121.0/24 to any port 6379

Step 6: Use the Redis utility and ping it to verify that everything is set up successfully or not.

$ redis-cli

You can also check out the information of the Redis Server by writing out the following command.

$ redis-cli info server

Conclusion:

In this article, we have shown you a complete procedure for installing and configuring Redis Server on Ubuntu 20.04.

Subscribe to Our Newsletter
Join our Newsletter and get the latest Linux news and tips
in your inbox for FREE.