Back to site

Install Redis

Install redis-server on a HolyCloud VPS, configure bind, requirepass password, and firewall.

Install Redis

Redis serves as cache, message queue, or in-memory key-value store. On a HolyCloud VPS, install from repositories, bind to localhost (or a private IP), and protect access with requirepass.

Prerequisites

  • HolyCloud Linux VPS (Ubuntu 22.04/24.04 or Debian 12)
  • sudo access
  • Enough RAM (Redis uses memory for stored keys)

Tip: never expose Redis without a password on 0.0.0.0 — automated scans target port 6379.

Step 1: installation

sudo apt update
sudo apt install -y redis-server

Check version and service:

redis-server --version
sudo systemctl enable --now redis-server
sudo systemctl status redis-server

Default local test:

redis-cli ping

Expected response: PONG.

Step 2: bind and network configuration

Main file is /etc/redis/redis.conf (Debian/Ubuntu may also use redis.conf under /etc/redis/).

sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.bak
sudo nano /etc/redis/redis.conf

Local listen only (recommended for an app on the same VPS):

bind 127.0.0.1 -::1
protected-mode yes
port 6379

Listen on private IP (e.g. another VPS in the same HolyCloud VLAN):

bind 10.0.0.5 127.0.0.1
protected-mode yes

Do not listen on all interfaces unless explicitly required — avoid:

bind 0.0.0.0

Apply changes:

sudo systemctl restart redis-server
ss -tlnp | grep 6379

Step 3: requirepass password

Generate a strong password:

openssl rand -base64 32

In redis.conf, uncomment and set (Redis 6+):

requirepass VotreMotDePasseRedisTresLong

Or with ACL (Redis 6+) for a dedicated user:

user monapp on >MotDePasseApp ~* &* +@all -@dangerous

Restart:

sudo systemctl restart redis-server

Authenticated connection:

redis-cli
AUTH VotreMotDePasseRedisTresLong
PING

One-liner:

redis-cli -a 'VotreMotDePasseRedisTresLong' ping

Environment variable for applications:

export REDIS_URL="redis://:[email protected]:6379/0"

Step 4: persistence and limits (optional)

AOF for more durability:

appendonly yes
appendfsync everysec

Memory limit (avoid saturating the VPS):

maxmemory 256mb
maxmemory-policy allkeys-lru
sudo systemctl restart redis-server

Step 5: UFW firewall

By default, do not open 6379 to the Internet. If another server must connect:

sudo ufw allow from 10.0.0.6 to any port 6379 proto tcp
sudo ufw status

Verification

redis-cli -a 'VotreMotDePasseRedisTresLong' INFO server | head
redis-cli -a 'VotreMotDePasseRedisTresLong' SET test:cle "ok" EX 60
redis-cli -a 'VotreMotDePasseRedisTresLong' GET test:cle

Logs: sudo journalctl -u redis-server -f.

Need help?

For connectivity issues between HolyCloud VPS instances, check IP, bind, firewall, and provide logs to support.