Redis Installation and Password Reset Guide

Install Redis, secure it, and recover access on Ubuntu, Rocky Linux, and Windows environments.

Back to Guides ยท Home

What this guide covers: Redis installation, service startup, password/ACL security basics, and account recovery if access is lost.

Recommended setup: keep Redis on private networks unless you have strict firewall and TLS protections in place.

1. Prerequisites

  1. Server administrator access (sudo).
  2. A backup/snapshot for production systems before security changes.
  3. Firewall policy that blocks Redis port 6379 from public internet unless explicitly required.

2. Install Redis on Ubuntu / Debian

# Update packages
sudo apt update

# Install Redis
sudo apt install -y redis-server

# Enable and start
sudo systemctl enable --now redis-server
sudo systemctl status redis-server --no-pager

# Basic check
redis-cli ping

3. Install Redis on Rocky / AlmaLinux / CentOS

# Install Redis package
sudo dnf install -y redis

# Enable and start
sudo systemctl enable --now redis
sudo systemctl status redis --no-pager

# Basic check
redis-cli ping

4. Windows Options

  1. Preferred: run Redis in WSL2 (Ubuntu) and follow Linux instructions.
  2. Alternative: run Redis via Docker container.
# Docker quick run (Windows or Linux)
docker run -d --name redis -p 6379:6379 redis:7

5. Secure Redis (Password and Network)

Edit Redis config and keep it reachable only where needed.

# Common config locations:
# Ubuntu: /etc/redis/redis.conf
# Rocky:  /etc/redis.conf

# Suggested settings:
bind 127.0.0.1 ::1
protected-mode yes
requirepass NewStrongPassword!123
# Restart service after config changes
sudo systemctl restart redis-server
# or
sudo systemctl restart redis

# Test with auth
redis-cli
AUTH NewStrongPassword!123
PING

6. Recover Access / Reset Forgotten Password

Safe method: stop Redis, temporarily remove or replace requirepass in config, then restart and set a new password.

# 1) Stop Redis
sudo systemctl stop redis-server
# or
sudo systemctl stop redis

# 2) Edit config and set a new password (or temporarily comment requirepass)
sudo nano /etc/redis/redis.conf
# or
sudo nano /etc/redis.conf

# 3) Start Redis
sudo systemctl start redis-server
# or
sudo systemctl start redis

# 4) Verify
redis-cli
AUTH NewStrongPassword!123
PING

If ACL is enabled in your environment, reset credentials with ACL SETUSER from an authorized session.

7. Useful Maintenance Commands

# Memory and persistence info
redis-cli INFO memory
redis-cli INFO persistence

# Save snapshot
redis-cli BGSAVE

# View logs (systemd)
sudo journalctl -u redis --no-pager | tail -n 50
sudo journalctl -u redis-server --no-pager | tail -n 50

8. Common Troubleshooting

Issue Typical Cause Fix
NOAUTH Authentication required Password is enabled but no AUTH provided Run AUTH your_password first
Cannot connect to Redis Service down, wrong bind address, firewall blocked Check service status, bind setting, and port rules
Redis exposed publicly 0.0.0.0 bind + open firewall Restrict network, set auth, and isolate access