How to Set Up Redis
How to Set Up Redis
Installation
# Ubuntu/Debian
apt update
apt install redis-server -y
# CentOS/AlmaLinux
dnf install redis -y
Configuration
Edit /etc/redis/redis.conf and set key values:
# Bind to localhost only (recommended for security)
bind 127.0.0.1
# Set a password
requirepass YourStrongRedisPassword
# Set max memory
maxmemory 256mb
maxmemory-policy allkeys-lru
Start and enable:
systemctl start redis
systemctl enable redis
Test the connection:
redis-cli
AUTH YourStrongRedisPassword
PING
# Should return: PONG
Security note: Never expose Redis to the public internet without authentication and firewall rules.