For Amazon Linux 2023 users, the standard Redis package isn't available in the default repositories. Instead, Amazon provides Redis6 as the primary version. Here's the installation command:
sudo dnf -y install redis6
This will install Redis 6.2.6 (as of AL2023's current package listing) along with all necessary dependencies.
After installation, you might notice the configuration isn't where you'd typically expect it. While the package creates /etc/redis6/
directory, it might appear empty at first glance due to how the package is structured.
To verify the configuration file exists:
sudo ls -la /etc/redis6/
The main configuration file is actually present as redis6.conf
. You can access it using:
sudo nano /etc/redis6/redis6.conf
Here are critical settings you should consider modifying for production use:
# Bind to all interfaces (comment out for local only)
# bind 127.0.0.1
# Set a strong password
requirepass your_secure_password
# Enable persistence
appendonly yes
appendfilename "appendonly.aof"
# Systemd integration
supervised systemd
Amazon Linux 2023 uses systemd for service management. Key commands:
# Start Redis6
sudo systemctl start redis6
# Enable auto-start on boot
sudo systemctl enable redis6
# Check status
sudo systemctl status redis6
All Redis commands in AL2023 use redis6-
prefix instead of the standard redis-
:
# Basic connection
redis6-cli
# Authenticated connection
redis6-cli -a your_password
# Testing connection
redis6-cli ping
If you encounter connection issues:
# Check listening ports
sudo netstat -tulnp | grep redis
# Verify SELinux context
sudo ls -Z /etc/redis6/
# Review logs
sudo journalctl -u redis6 -f
For production environments, consider these additional settings:
# Memory management
maxmemory 2gb
maxmemory-policy allkeys-lru
# Client connections
maxclients 10000
# Timeout settings
timeout 300
tcp-keepalive 60
Amazon Linux 2023 (AL2023) has a different package naming convention compared to other Linux distributions. While you might expect to find a redis
package, AL2023 specifically provides redis6
as its default Redis implementation. This is documented in the official package listings.
To install Redis 6 on AL2023, run:
sudo dnf -y install redis6
sudo systemctl enable redis6
sudo systemctl start redis6
The configuration file isn't immediately visible when listing the directory contents, but it exists at:
/etc/redis6/redis6.conf
You can verify this by using:
sudo ls -la /etc/redis6/
sudo cat /etc/redis6/redis6.conf
Here's how to modify some common settings:
sudo nano /etc/redis6/redis6.conf
Example changes:
# Set Redis to bind to all interfaces
bind 0.0.0.0
# Enable protected mode (security)
protected-mode yes
# Set a password (uncomment and change)
requirepass your_strong_password
# Enable systemd integration
supervised systemd
Use the redis6-cli command instead of the standard redis-cli:
redis6-cli
# With authentication:
redis6-cli -a your_strong_password
Check if Redis is running:
sudo systemctl status redis6
redis6-cli ping
# Should return "PONG"
If you encounter issues:
# Check logs
journalctl -u redis6 -f
# Test configuration file
sudo redis6-server /etc/redis6/redis6.conf --test
# Check listening ports
sudo netstat -tulnp | grep redis
After modifying the configuration:
sudo systemctl restart redis6
sudo systemctl status redis6