DEV Community 👩‍💻👨‍💻

Mrityunjaya Prajapati
Mrityunjaya Prajapati

Posted on

How to Install Redis on Linux Server (Ubuntu 20.04)

What is Redis Cache

Redis is an open-source in-memory key-value data store. It can be used as a database, cache and queue. Redis supports various data structures such as Strings, Hashes, Lists, Sets, and more. Redis can provide high availability using Redis Node Cluster.

Install Redis on Ubuntu 20.04

You can install Redis on Linux Server using following commands

$sudo apt update
$sudo apt install redis-server

Once the installation is done, then Redis service will start automatically. You can check the status of the Redis service using following command:

$sudo systemctl status redis-server

You will get following output

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

Test Redis Server Locally

To verify that everything is set up properly, you can try to ping the Redis server from your server using the redis-cli command:
redis-cli -h <REDIS_IP_ADDRESS> ping

If you are testing locally from server then, this *REDIS_IP_ADDRESS * would be 127.0.0.1

Above command should return a response of PONG

Test Redis Server Remotely

To verify that everything is set up properly, you can try to ping the Redis server from your Remote Machine using the redis-cli command:

redis-cli -h <REDIS_IP_ADDRESS> ping

REDIS_IP_ADDRESS would be your Server Public IP Address where Redis is installed.

Above command should return a response of PONG

*IMPORTANT *– Redis run on port: 6379 so you have to open this Port to communicate from Remote machine.

Top comments (0)

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.