Databases Beginner 10 min

How to Install and Secure Redis In-Memory Cache on Ubuntu 24.04

Accelerate web application caching while securing Redis against unauthorized network access and command injection

IndSoft Cloud Engineering
Reviewed October 2026
Production Verified Commands

Guide Overview & Architecture Outcome

By following this guide, you will install Redis in-memory cache server on Ubuntu 24.04. You will configure it to bind exclusively to localhost, enforce a strong authentication password, and integrate with systemd supervision.

Table of Contents
Practice on Live Cloud

Spin up an Ubuntu 24.04 instance with instant activation to test this tutorial:

Deploy IndSoft VPS

Prerequisites & System Requirements

An Ubuntu 24.04 server with at least 512 MB free RAM.

1

Install Redis Server from Official Repositories

Install Redis server and client binaries.

bash · step-1-command.sh
sudo apt update && sudo apt install redis-server -y
Expected System Output:
Installed.
2

Configure Redis for Systemd Supervision and Local Binding

Update /etc/redis/redis.conf to bind to 127.0.0.1 and enable systemd supervision.

bash · step-2-command.sh
sudo nano /etc/redis/redis.conf # Set: supervised systemd # Set: bind 127.0.0.1 ::1 # Set: requirepass YOUR_VERY_LONG_AUTH_KEY sudo systemctl restart redis-server
Expected System Output:
Redis restarted with password authentication enabled.

Check That It Worked (Verification)

Run this quick verification check to confirm your installation is responding properly:

verify-service.sh
redis-cli -a YOUR_VERY_LONG_AUTH_KEY ping
Expected Response:
PONG

Troubleshooting Common Errors

Quick resolutions for frequent setup pitfalls and configuration issues.

Diagnostic Tips
Redis exposed to the public internet (NOAUTH error)
Check /etc/redis/redis.conf and verify bind 127.0.0.1 is active and not commented out.
OOM command not allowed when used memory > 'maxmemory'
Configure an eviction policy in redis.conf: maxmemory-policy allkeys-lru.
Service fails to start under systemd
Ensure supervised systemd is set and permissions on /var/lib/redis are owned by redis:redis.