How to Install and Configure Redis on RHEL 8
Redis is an in-memory data store used for caching, sessions, queues, and lightweight application state. On RHEL 8, the packaged server gives administrators local control, predictable file ownership, and close integration with systemd, SELinux, and firewalld.
For Australian administrators, an “arvo” maintenance window is a familiar way to describe an afternoon slot. Many estates place workloads in the Sydney or Melbourne cloud regions, so Redis latency should be measured from the application host rather than an engineer’s desk. AEST and AEDT changes also matter when comparing logs, backups, and incident timestamps.
The Australian market combines managed Redis services from AWS, Azure, and Google Cloud with in-house RHEL systems. The steps below suit a self-managed RHEL 8 host, assuming root access through sudo, an approved package repository, and a tested configuration backup.
Prepare the RHEL 8 host
Start by confirming the operating system, processor architecture, and configured repositories:
cat /etc/redhat-release
uname -m
sudo dnf repolist
sudo dnf makecache
The host may use Red Hat’s subscription repositories, an organisation-specific mirror, or an approved EPEL mirror. Confirm that the Redis package is available before changing anything:
sudo dnf list --available redis
If it is missing, arrange access to the correct repository instead of bypassing package signatures or installing an unverified binary. For readers who need a refresher, the site's Linux commands collection covers package management, service control, permissions, and networking commands.
Install the Redis package
Install the distribution package so its configuration directories, SELinux policy, and systemd unit remain under package management:
sudo dnf install -y redis
rpm -q redis
redis-server --version
The package normally provides the redis-server and redis-cli programs, the redis service account, /etc/redis/redis.conf, and persistent storage under /var/lib/redis.
Check whether the service started automatically:
sudo systemctl status redis --no-pager
Its default listener should remain on the loopback interface. If the packaged version is too old for an application requirement, plan a controlled upgrade rather than mixing distribution packages with manually compiled binaries.
Configure Redis for the workload
Back up the configuration before editing it:
sudo cp -a /etc/redis/redis.conf \
"/etc/redis/redis.conf.bak.$(date +%Y%m%d%H%M%S)"
sudoedit /etc/redis/redis.conf
A conservative starting configuration is:
bind 127.0.0.1
protected-mode yes
port 6379
supervised systemd
daemonize no
appendonly yes
appendfsync everysec
dir /var/lib/redis
The append-only file setting favours data durability across restarts. A cache-only service may disable persistence, but that choice should be documented because data will disappear when Redis stops.
Keep the listener local unless remote clients genuinely require it. For a private application subnet, add the host’s private address to bind and configure strong authentication through ACLs on Redis 6 or later, or requirepass on Redis 5. Deliver credentials through your approved secrets-management process rather than shell history.
Create the runtime directories with the correct account and restore SELinux labels:
sudo install -d -o redis -g redis -m 0750 /var/lib/redis /var/log/redis
sudo chown root:redis /etc/redis/redis.conf
sudo chmod 640 /etc/redis/redis.conf
sudo restorecon -Rv /etc/redis /var/lib/redis /var/log/redis
Enable and supervise the service
Enable Redis at boot, then restart it to apply the revised configuration:
sudo systemctl enable redis
sudo systemctl restart redis
sudo systemctl status redis --no-pager
sudo journalctl -u redis -n 50 --no-pager
Before restarting, confirm that the unit reads the file you edited:
sudo systemctl cat redis
The ExecStart directive should reference /etc/redis/redis.conf. If startup fails, inspect the journal for permission errors, invalid directives, missing directories, or an occupied TCP port. Resolve the reported fault before retrying the service.
Secure access and validate data
Test the local endpoint with a short-lived key:
redis-cli ping
redis-cli SET lnp:check "healthy" EX 60
redis-cli GET lnp:check
redis-cli DEL lnp:check
The first command should return PONG, and the GET command should return healthy. Inspect the listener to confirm where Redis is accepting connections:
sudo ss -ltnp | grep ':6379'
If firewalld is active, permit only the application subnet that needs Redis:
sudo firewall-cmd --state
sudo firewall-cmd --permanent \
--add-rich-rule='rule family="ipv4" source address="10.20.0.0/24" port port="6379" protocol="tcp" accept'
sudo firewall-cmd --reload
Replace the example subnet and coordinate the rule with cloud security groups. Never allow unrestricted access to port 6379.
Teams validating a mobile client on an engineering workstation can use a multi-instance testing setup in BlueStacks to create separate sessions against a VPN-accessible lab Redis endpoint. Keep emulator traffic and production credentials isolated.
Test a remote authenticated client with:
redis-cli -h 10.20.0.15 --askpass ping
If SELinux denies a connection, review recent policy denials with sudo ausearch -m avc -ts recent rather than disabling the security system.
Verify the deployment and retain the result
Check the running version, persistence, memory usage, and effective configuration after the final restart:
redis-cli INFO server
redis-cli INFO persistence
redis-cli INFO memory
redis-cli CONFIG GET appendonly
Use --askpass when the selected account requires authentication. Compare the deployed access pattern with the intended workload:
| Access pattern | Recommended controls | Best suited to | Main exposure |
|---|---|---|---|
| Same RHEL host | Bind to 127.0.0.1; permit no inbound rule |
An application on the same server | Smallest network surface |
| Private application subnet | Private bind address, ACL or password, firewalld source rule, matching cloud security group | Several authorised application servers | Incorrect network rules |
| Internet-facing endpoint | Managed gateway, private tunnel, TLS, strong authentication, auditing, and a formal risk review | Exceptional cases only | Highest attack and data-loss risk |
The result to remember is simple: keep Redis narrowly reachable, protect its files with correct ownership and SELinux labels, persist data according to the workload, and verify the service, access path, and stored values together after every change.