This article was contributed by the folks at RackNerd – a provider of shared hosting, reseller hosting, VPS hosting, dedicated servers, DRaaS, colocation, and more. If you are looking for a VPS with full root access to set up Redis on, be sure to review their latest LowEndBox special offers here.
Redis, or Remote Dictionary Server, was created by Salvatore Sanfilippo in 2009. It is an open-source project and provides an in-memory data structure platform. It implements a key-value distributed database supporting various types of data, such as sets, bitmaps, streams, and spatial indexes. The Redis is popularly used as a cache, message broker, and database.
Today, we will see how you can install and use the Redis software on your Ubuntu 20.04 system.
This tutorial is for Ubuntu 20.04, so make sure your operating system is running Ubuntu 20.04. Also, root access to the system is required before we proceed.
It is an easy job to get Redis installed on your system because it is included in the repositories of Ubuntu 20.04.
Run the following commands to get Redis installed:
sudo apt update
sudo apt install redis-server
After the installation is done, Redis will automatically start running in the background. To make sure that the installation was successful, run the next command:
sudo systemctl status redis-server
If the installation were completed successfully, you would see the Redis server’s status as the output.
In case Redis is installed properly, but it fails to start, make sure that IPv6 is disabled on the server.
By default, you can only connect to Redis through the local host at 127.0.0.1. However, you can also enable remote access for Redis.
To enable remote access, you need to open the config file for Redis. You can do this by the following command:
sudo nano /etc/redis/redis.conf
Now, find the line that says, “bind 127.0.0.1 ::1” and put a “#” before it to comment that line. You can now save the file and restart the Redis service by running this command.
sudo systemctl restart redis-server
To confirm that remote access has been configured, run the following command.
ss -an | grep 6379
If the output displays 0.0.0.0, it means that it is listening to all IP addresses on port 6379.
Now that we have configured the remote access for Redis. We need to configure the firewall for port 6379 so that incoming connections are allowed. Run the following command to enable traffic for Redis.
sudo ufw allow proto tcp from 192.168.111.0/24 to any port 6379
Make sure that you replace “192.1.168.111.0/24” with the IP address of your remote server. The firewall only allows traffic from this IP address.
To verify the remote access, you can run the following command on your remote machine:
redis-cli -h ping
If everything is working properly, you will see the output that says “PONG”.
Thanks for reading! Please leave any questions or feedback below.
The post How to Install and Use Redis on a Ubuntu 20.04 Server appeared first on Low End Box.
Canonical is continuously hiring new talent. Being a remote- first company, Canonical’s new joiners receive…
What is patching automation? With increasing numbers of vulnerabilities, there is a growing risk of…
Wouldn’t it be wonderful to wake up one day with a desire to explore AI…
Ubuntu and Ubuntu Pro supports Microsoft’s Azure Cobalt 100 Virtual Machines (VMs), powered by their…
Welcome to the Ubuntu Weekly Newsletter, Issue 870 for the week of December 8 –…
Canonical is pleased to announce security patching and support for Valkey through the Ubuntu Pro…