How To Install Redis on Ubuntu 22.04

Redis:

Redis (REmote DIctionary Server) is an open source, in-memory, NoSQL key/value store that is used primarily as an application cache or quick-response database.

Getting started with Redis

1. System Update

sudo apt update
sudo apt upgrade -y

2. Add Redis Official APT Repository

Install required packages:

sudo apt-get install lsb-release curl gpg -y

Import Redis GPG key:

curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg

Set correct permissions:

sudo chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg

Add Redis repository to APT sources:

echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list

Update APT cache:

sudo apt-get update

2. Add Redis Official APT Repository


4. Enable Redis Service


5. Test Redis Service

Expected output:

Exit:


6. Configure Redis for systemd & Security

Open configuration file:

6.1 Enable systemd supervision

Search or manually add:

6.1 Enable systemd supervision

Find:

Uncomment and modify:

6.3 (Optional) Enable Remote Access

Only if required for external applications:

Save and exit (CTRL+O, Enter, CTRL+X)

Restart Redis:


6.3 (Optional) Enable Remote Access

Output:

Last updated