Redis 7.2 is an in-memory data store used as a cache, session store, and message broker. Ubuntu 24.04 LTS provides Redis in its repositories. This guide installs and secures it.

Tested and valid on:

  • Ubuntu 24.04 LTS

Prerequisites

  • Ubuntu 24.04 LTS server
  • A user with sudo privileges

Step 1 – Install Redis

Install from the Ubuntu repository:

sudo apt update
sudo apt install redis-server -y

Step 2 – Configure Redis

Open the configuration file:

sudo nano /etc/redis/redis.conf

Set Redis to run as a daemon supervised by systemd — change the supervised directive:

supervised systemd

Step 3 – Set a Password

Find and uncomment the requirepass line in redis.conf:

requirepass YourStrongRedisPassword

Step 4 – Restart and Enable Redis

Apply the configuration:

sudo systemctl restart redis-server
sudo systemctl enable redis-server

Step 5 – Verify Redis Is Running

Check the service:

sudo systemctl status redis-server

Step 6 – Test with redis-cli

Connect to the Redis CLI:

redis-cli

Authenticate and test:

AUTH YourStrongRedisPassword
SET testkey "Hello"
GET testkey
EXIT

Step 7 – Allow Remote Connections (optional)

To bind Redis to a specific IP for remote access, edit redis.conf:

bind 0.0.0.0

Then open UFW:

sudo ufw allow 6379/tcp

Step 8 – Check the Version

Verify the installed version:

redis-server --version

Conclusion

Redis 7.2 is now running on Ubuntu 24.04 LTS with password authentication. It can serve as a cache layer for MySQL, a PHP session store, or a Pub/Sub message broker.