Table of Contents
Redis is an in-memory key–value data store commonly used for caching, queues, sessions, and real-time analytics. Ubuntu 25 includes Redis in its official repositories, so installation is clean and reliable.
Step 1: Update System Packages
Start with an updated system to avoid dependency issues.
sudo apt update && sudo apt upgrade -y
Step 2: Install Redis Server
Install Redis directly from Ubuntu repositories:
sudo apt install -y redis-server
This installs both the Redis server and CLI tools.
Step 3: Enable and Start Redis Service
Make sure Redis starts automatically on boot and is running now:
sudo systemctl enable --now redis-server
Check status:
systemctl status redis-server
You should see active (running).
Step 4: Test Redis Installation
Verify Redis is responding correctly:
redis-cli ping
Expected output:
PONG
This confirms Redis is working.
Step 5: Configure Redis for Supervised Systemd
Ubuntu uses systemd, so Redis should be supervised correctly.
Edit the config file:
sudo nano /etc/redis/redis.conf
Find and set:
supervised systemd
Restart Redis:
sudo systemctl restart redis-server
Step 6: Basic Security Configuration
Redis should not be exposed publicly.
Confirm it listens only on localhost:
grep bind /etc/redis/redis.conf
Expected:
bind 127.0.0.1 ::1
If needed, edit:
sudo nano /etc/redis/redis.conf
Set:
bind 127.0.0.1 ::1
protected-mode yes
Restart Redis:
sudo systemctl restart redis-server
Step 7: Verify Redis Is Not Publicly Accessible
Check listening ports:
ss -tulnp | grep 6379
Redis should only be bound to localhost.
Optional Step: Set a Redis Password
If Redis is used by multiple local services, add authentication.
Edit config:
sudo nano /etc/redis/redis.conf
Set:
requirepass StrongPasswordHere
Restart Redis:
sudo systemctl restart redis-server
Test authentication:
redis-cli
AUTH StrongPasswordHere
PING