YouTube Icon

Code Playground.

How to Install and Configure Redis on Ubuntu 20.04


How to Install and Configure Redis on Ubuntu 20.04

Redis is an open-source in-memory key-esteem information store. It tends to be utilized as an information base, store and, message representative, and supports different information structures, for example, Strings, Hashes, Lists, Sets, and that's just the beginning. Redis gives high accessibility through Redis Sentinel and programmed apportioning over numerous Redis hubs with Redis Cluster. 

This instructional exercise portrays how to introduce and design Redis on Ubuntu 20.04. 

Installing Redis on Ubuntu 20.04

Introducing Redis on Ubuntu is a direct cycle. 

Redis adaptation 5.0.x is remembered for the default Ubuntu 20.04 vaults. To introduce it run the accompanying orders as root or client with sudo benefits : 

sudo apt update
sudo apt install redis-server

When the establishment is finished, the Redis administration will begin naturally. To check the status of the administration, enter the accompanying order: 

sudo systemctl status redis-server

You should see something like this: 

 redis-server.service - Advanced key-value store
     Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2020-06-06 20:03:08 UTC; 10s ago

Redis administration will neglect to begin if IPv6 is incapacitated on your worker. 

That is it. You have Redis introduced and running on your Ubuntu 20.04 worker. 

Configure Redis Remote Access

Of course, the Redis worker doesn't acknowledge distant associations. You can associate with Redis just from (localhost) - the machine where Redis is running. 

On the off chance that you are utilizing a solitary worker arrangement, where the customer interfacing with the information base is likewise running on a similar host, you ought not empower distant access. 

To design Redis to acknowledge distant associations open the Redis setup record with your content tool: 

sudo nano /etc/redis/redis.conf

Find the line that starts with tie ::1 and remark it. 


# bind ::1

On the off chance that your worker has a private IP, and you need Redis to be reachable just from the private organization as opposed to remarking the line, the private IP address after 

Spare the record and restart the Redis administration for changes to produce results: 

sudo systemctl restart redis-server

Utilize the accompanying order to confirm that redis is tuning in on all interfaces on port 6379: 

ss -an | grep 6379

You should see something like beneath. methods all IPv4 addresses on the machine. 

tcp  LISTEN 0   511*
tcp  LISTEN 0   511      [::]:6379      [::]:*  

Next, you'll have to design your firewall to empower traffic on TCP port 6379. 

Ordinarily you would need to permit admittance to the Redis worker just from a particular IP address or IP go. For instance, to permit associations just from the subnet, you would run the accompanying order: 

sudo ufw allow proto tcp from to any port 6379

Ensure your firewall is arranged to acknowledge associations just from believed IP ranges. 

Now, you ought to have the option to interface with Redis on TCP port 6379 from distant areas. 

To check that everything is set up appropriately, you can attempt to ping the Redis worker from your distant machine utilizing the redis-cli utility: 

redis-cli -h <REDIS_IP_ADDRESS> ping

The order should restore a reaction of PONG: 



We've told you the best way to introduce Redis on Ubuntu 20.04. To discover more data about how to deal with your Redis establishment, visit the Redis documentation page. 

In the event that you hit an issue or have criticism, leave a remark beneath.