Fast cache reads matter when an application would otherwise keep asking a disk-backed database for the same session, queue, or page-fragment data. To install Redis on Rocky Linux today, first decide whether your stack needs the Redis package itself or whether Redis-compatible Valkey is enough, because Rocky Linux 10 and 9 both provide Valkey in AppStream while Rocky Linux 8 still uses the older Redis module stream.
Rocky Linux 10 is where the package choice matters most: its default path is Valkey, not Redis. Rocky Linux 9 can use either Valkey 8.0.x or Redis 6.2.x from AppStream, while Rocky Linux 8 offers Redis 5.0 by default and Redis 6.2 as an optional module stream. Use Remi only when an application specifically requires Redis packages or a newer Redis branch than AppStream provides.
Install Redis on Rocky Linux
Start with the package source that matches your release and application requirement. Valkey keeps Redis command and protocol compatibility, but it does not install redis-server or redis-cli command names on Rocky Linux, so applications or scripts that call those names directly still need Redis from AppStream or Remi.
If you are comparing RHEL-family packaging notes, keep the Rocky result separate: Rocky Linux 10 uses Valkey from AppStream, while Redis package names require Remi.
| Method | Rocky Release | Package | Service | Best Fit |
|---|---|---|---|---|
| Valkey from AppStream | 10 and 9 | valkey 8.0.x | valkey | Default Redis-compatible server when your application accepts Valkey command names |
| Redis from AppStream | 9 | redis 6.2.x | redis | Stable distro package when your application expects Redis binaries |
| Redis from AppStream | 8 | redis 5.0 by default, 6.2 with module stream 6 | redis | Maintenance-mode Rocky 8 systems that need the distro-owned package |
| Redis from Remi | 10, 9, and 8 | redis streams such as 7.2, 8.0, 8.2, 8.4, and 8.6 | redis | Applications that need Redis specifically or a newer branch than AppStream ships |
Rocky Linux 10, 9, and 8 remain in scope. Each package path is separated by release so Rocky 10 users do not try to install an AppStream Redis package that is no longer present there.
Update Rocky Linux Before Installing Redis
Refresh package metadata and apply available system updates before installing the cache server:
sudo dnf upgrade --refresh
Use sudo because the install, service, configuration, and firewall commands change system-wide state. If package downloads are unusually slow, the separate guide to increase DNF speed on Rocky Linux explains mirror and parallel download settings.
Install Valkey on Rocky Linux 10 or 9
Use this method when your application only needs the Redis protocol and can call valkey-server or connect to the service over TCP. Rocky Linux 10 users should start here unless a vendor or application explicitly requires the Redis package name.
sudo dnf install valkey -y
Verify the installed server command:
valkey-server --version
Example output from Rocky Linux 10 AppStream looks like this. The build hash can vary between Rocky releases:
Valkey server v=8.0.7 sha=00000000:1 malloc=jemalloc-5.3.0 bits=64 build=e107d3ee83b68577
Enable the Valkey service and start it now:
sudo systemctl enable valkey --now
Confirm the service is active and enabled for boot:
systemctl is-active valkey
systemctl is-enabled valkey
active enabled
Test the local service:
valkey-cli ping
PONG
Install Redis from AppStream on Rocky Linux 9
Rocky Linux 9 still provides Redis from AppStream. The default Redis module stream currently installs Redis 6.2.x and the traditional redis-server and redis-cli commands.
dnf module list redis
Relevant output includes:
Rocky Linux 9 - AppStream Name Stream Profiles Summary redis 7 common [d] Redis persistent key-value database
Install Redis from the default stream:
sudo dnf install redis -y
Start Redis and verify it responds:
sudo systemctl enable redis --now
systemctl is-active redis
systemctl is-enabled redis
redis-server -v
redis-cli ping
Example output from Rocky Linux 9 AppStream:
active enabled Redis server v=6.2.20 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=77f087a7c7063959 PONG
Install Redis from AppStream on Rocky Linux 8
Rocky Linux 8 provides Redis through module streams. The default stream installs Redis 5.0, while stream 6 installs Redis 6.2 for applications that need a newer Redis 6 branch.
dnf module list redis
Relevant output includes:
Rocky Linux 8 - AppStream Name Stream Profiles Summary redis 5 [d] common [d] Redis persistent key-value database redis 6 common [d] Redis persistent key-value database
Install the default Redis 5 stream:
sudo dnf install redis -y
To install Redis 6.2 instead, enable stream 6 first:
sudo dnf module enable redis:6 -y
sudo dnf install redis -y
Start Redis and verify the local server:
sudo systemctl enable redis --now
systemctl is-active redis
systemctl is-enabled redis
redis-server -v
redis-cli ping
Example output from the Rocky Linux 8 default stream:
active enabled Redis server v=5.0.3 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=7fa21edfc0646001 PONG
If you enabled stream 6, the version line reports Redis 6.2.x instead.
Install Redis from Remi on Rocky Linux
Use Remi when the application must see Redis package names on Rocky Linux 10, or when Rocky Linux 9 or 8 needs a newer Redis branch than AppStream provides. The Remi path adds third-party repositories, so keep it for systems where the newer Redis stream is a real requirement.
Do not install Valkey and Remi Redis side by side on the same default port. If Valkey is already installed, stop it and remove it before switching to Redis:
sudo systemctl stop valkeyfollowed bysudo dnf remove valkey.
Install the repository tooling, enable the matching dependency repository, then add EPEL and Remi. Rocky Linux still uses DNF4 syntax here, including dnf config-manager --set-enabled, even on Rocky Linux 10.
sudo dnf install dnf-plugins-core -y
case "$(rpm -E %rhel)" in
8)
sudo dnf config-manager --set-enabled powertools
;;
9|10)
sudo dnf config-manager --set-enabled crb
;;
*)
echo "Unsupported Enterprise Linux major release."
exit 1
;;
esac
sudo dnf install epel-release -y
sudo dnf install "https://rpms.remirepo.net/enterprise/remi-release-$(rpm -E %rhel).rpm" -y
If DNF asks to import a signing key during the first Remi package transaction, confirm that the prompt names Remi’s RPM repository and imports the key from /etc/pki/rpm-gpg/. Do not bypass a key prompt that names an unexpected repository or path.
Verify that Remi installed the expected repository package and enabled its stable repository IDs:
rpm -q remi-release epel-release
dnf repolist --enabled | grep -E '^(remi-modular|remi-safe|epel)'
On Rocky Linux 10, relevant output includes the following lines. The release package suffixes differ on Rocky Linux 9 and 8:
remi-release-10.1-3.el10.remi.noarch epel-release-10-7.el10_1.noarch epel Extra Packages for Enterprise Linux 10 - x86_64 remi-modular Remi's Modular repository for Enterprise Linux 10 - x86_64 remi-safe Safe Remi's RPM repository for Enterprise Linux 10 - x86_64
List Redis streams before selecting one. Remi can add newer streams over time, so choose the branch your application supports rather than enabling the highest number automatically.
dnf module list redis
Current Remi output on Rocky Linux 10 includes these Redis streams. Rocky Linux 9 and 8 can also show older Remi streams such as 5.0, 6.0, 6.2, and 7.0:
Remi's Modular repository for Enterprise Linux 10 - x86_64 Name Stream Profiles Summary redis remi-7.2 common [d] Redis persistent key-value database redis remi-8.0 common [d] Redis persistent key-value database redis remi-8.2 common [d] Redis persistent key-value database redis remi-8.4 common [d] Redis persistent key-value database redis remi-8.6 common [d] Redis persistent key-value database
Pick the stream that matches your application support policy, then keep that branch selected until you intentionally migrate.
Enable the stream you want. This example uses remi-8.6; replace it with another listed stream when your application requires a different Redis branch.
sudo dnf module reset redis -y
sudo dnf module enable redis:remi-8.6 -y
sudo dnf install redis -y
Start Redis and confirm the service:
sudo systemctl enable redis --now
systemctl is-active redis
systemctl is-enabled redis
redis-server -v
redis-cli ping
Example output for a Remi Redis 8.x stream:
active enabled Redis server v=8.6.3 sha=00000000:0 malloc=jemalloc-5.3.0 bits=64 build=5d1ead486b651156 PONG
The dedicated guide to install the Remi RPM repository on Rocky Linux covers repository maintenance, PHP streams, Redis streams, and removal in more detail. For repository-only setup help, see install EPEL on Rocky Linux.
Use Valkey or Redis on Rocky Linux
Valkey and Redis share the same command protocol, so basic client operations look the same once you choose the correct CLI name. Use valkey-cli for Valkey packages and redis-cli for Redis packages.
Connect to the Local Server
Connect to Valkey:
valkey-cli
Connect to Redis:
redis-cli
The prompt changes to the server address and port:
127.0.0.1:6379>
Run Basic Key Commands
Inside either CLI, store a test key, read it back, then delete it:
SET lc_test "Rocky Linux cache test"
GET lc_test
DEL lc_test
exit
The key commands return:
OK "Rocky Linux cache test" (integer) 1
For PHP applications such as WordPress or Laravel, install the matching PHP runtime and Redis extension after the server is running. The PHP on Rocky Linux guide covers PHP-FPM and extension package choices.
Configure Valkey or Redis on Rocky Linux
Valkey and Redis use similar directive names, but Rocky package layouts differ by package source and release. Open the correct configuration file before changing memory, binding, or authentication settings.
| Installed Package | Configuration File | Service |
|---|---|---|
| Valkey from AppStream on Rocky 10 or 9 | /etc/valkey/valkey.conf | valkey |
| Redis from AppStream on Rocky 9 | /etc/redis/redis.conf | redis |
| Redis from AppStream on Rocky 8 | /etc/redis.conf | redis |
| Redis from Remi on Rocky 10, 9, or 8 | /etc/redis/redis.conf | redis |
Open the file that matches your installed package:
sudo nano /etc/valkey/valkey.conf
sudo nano /etc/redis/redis.conf
sudo nano /etc/redis.conf
Use only one of those commands. The first path is for Valkey, the second is for Redis on Rocky 9 or Remi on Rocky 10 and 9, and the third is for Redis on Rocky 8.
Set a Memory Limit
Set maxmemory so the cache cannot consume all available RAM on a busy server:
maxmemory 512mb
Common values include 256mb, 512mb, 1gb, or 2gb. Choose a value that leaves memory for the operating system, web server, database, and application workers.
Choose an Eviction Policy
The eviction policy controls what happens when the server reaches maxmemory:
allkeys-lruevicts least recently used keys from the whole keyspace and fits general cache workloads.volatile-lruevicts least recently used keys only when those keys have an expiration set.allkeys-lfuevicts least frequently used keys and can work better for skewed traffic patterns.noevictionreturns errors instead of removing keys, which is safer when the data must not disappear automatically.
maxmemory-policy allkeys-lru
Bind to the Correct Network Address
The default localhost-only listener is the safest setting. If another internal host must connect, add the server’s private interface address while keeping localhost:
bind 127.0.0.1 192.168.1.50
protected-mode yes
Binding to
0.0.0.0exposes the server on every interface. Keep network exposure limited to private addresses, require authentication, and add a source-limited firewalld rule before remote clients connect.
Require Password Authentication
For a simple password-protected deployment, set requirepass in the same configuration file:
requirepass YourStrongPasswordHere
After this change, unauthenticated clients see this error:
(error) NOAUTH Authentication required.
Avoid putting the password directly in a shell command. For Valkey, use the CLI password prompt:
valkey-cli --askpass ping
PONG
For Redis, use the Redis CLI password prompt:
redis-cli --askpass ping
PONG
Restart the Service After Changes
Restart the service that belongs to your installed package:
sudo systemctl restart valkey
systemctl is-active valkey
active
For Redis, use the Redis service name instead:
sudo systemctl restart redis
systemctl is-active redis
active
The official Valkey documentation and Redis documentation explain advanced data types, persistence, replication, ACLs, and clustering.
Configure Firewalld for Remote Access
Skip this section when clients run on the same server. Firewalld rules are only needed after you bind Valkey or Redis to a private network address and want another host to connect to TCP port 6379.
Allow a Trusted Source Address
For most server deployments, allow only the application server or private subnet that needs access. Replace the source address and zone with values that match your network:
sudo firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="192.168.1.100" port protocol="tcp" port="6379" accept'
sudo firewall-cmd --reload
sudo firewall-cmd --zone=public --query-rich-rule='rule family="ipv4" source address="192.168.1.100" port protocol="tcp" port="6379" accept'
success success yes
To allow a whole private subnet, use a CIDR range instead:
sudo firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port protocol="tcp" port="6379" accept'
sudo firewall-cmd --reload
Use the Built-In Redis Service Rule Only for Broad Access
Firewalld also ships a Redis service definition for port 6379. This opens the port to the whole selected zone, so do not combine it with a rich rule and then assume access is source-limited.
sudo firewall-cmd --permanent --zone=public --add-service=redis
sudo firewall-cmd --reload
sudo firewall-cmd --zone=public --query-service=redis
success success yes
Test from an allowed client host with the matching CLI. Replace the IP address with the Valkey or Redis server address. For Valkey, use:
valkey-cli -h 192.168.1.50 ping
PONG
For Redis, use:
redis-cli -h 192.168.1.50 ping
PONG
Troubleshoot Valkey or Redis on Rocky Linux
redis-server Command Not Found on Rocky Linux 10
Rocky Linux 10 installs Valkey from AppStream, so Redis command names are not present unless you install Redis from Remi. Bash and Zsh show the missing command differently, but the cause is the same:
bash: redis-server: command not found zsh: command not found: redis-server
Check which server package is installed:
rpm -q valkey redis
If Valkey is installed, use Valkey command names:
valkey-server --version
valkey-cli ping
If the application calls redis-server or redis-cli directly and cannot be changed, install Redis from Remi instead of Valkey.
Service Fails After a Configuration Change
Check the matching service state first. For Redis, use:
systemctl is-active redis
A failed service returns:
failed
Use systemctl is-active valkey instead when Valkey is installed. Read the journal for the matching unit:
sudo journalctl -xeu redis --no-pager
Use sudo journalctl -xeu valkey --no-pager instead for Valkey. Configuration mistakes usually appear as a fatal config error or a bad directive:
*** FATAL CONFIG FILE ERROR *** >>> 'maxmemory-policy invalid_policy' Bad directive or wrong number of arguments
Fix the directive in the correct configuration file, then restart the service and confirm it is active:
sudo systemctl restart redis
systemctl is-active redis
active
Use valkey instead of redis in those commands when you installed Valkey.
Remote Clients Cannot Connect
First, verify the server listens on the expected address. A localhost-only listener cannot accept remote connections:
sudo ss -tlnp 'sport = :6379'
Relevant output for a localhost-only listener looks like this:
LISTEN 0 511 127.0.0.1:6379 0.0.0.0:* LISTEN 0 511 [::1]:6379 [::]:*
If the listener is still bound to localhost, add the server’s private IP address to the bind directive, restart the service, then recheck the listener. After the service listens on the private address, verify the firewall rich rule or service rule:
sudo firewall-cmd --zone=public --query-service=redis
yes
For source-limited rich rules, query the exact rule you added instead of checking the broad Redis service entry.
Memory Overcommit Warning Appears
Redis and Valkey can warn when Linux memory overcommit is disabled:
WARNING Memory overcommit must be enabled!
Check the current kernel value before changing it:
sysctl vm.overcommit_memory
A value of 0 means the warning applies:
vm.overcommit_memory = 0
Set the kernel value immediately and persist it in a dedicated sysctl file:
sudo sysctl -w vm.overcommit_memory=1
printf '%s\n' 'vm.overcommit_memory = 1' | sudo tee /etc/sysctl.d/99-redis.conf > /dev/null
sudo sysctl --system
Restart the cache service after changing the kernel setting:
sudo systemctl restart redis
Use sudo systemctl restart valkey instead when Valkey is installed.
Remi Stream Conflicts with AppStream
If DNF reports a module conflict after switching between AppStream and Remi, reset the Redis module and enable the desired stream again:
sudo dnf module reset redis -y
sudo dnf module enable redis:remi-8.6 -y
sudo dnf install redis -y
Replace remi-8.6 with the stream you selected from dnf module list redis.
Redis Fails After Downgrading a Remi Stream
If Redis fails immediately after moving from a newer Remi stream to an older one, check the Redis journal and log:
sudo journalctl -xeu redis --no-pager
sudo tail -n 50 /var/log/redis/redis.log
A version mismatch can appear as an RDB format error:
Can't handle RDB format version 13 Fatal error loading the DB
That means the older Redis server cannot read a dump file written by the newer branch. For production data, switch back to the newer stream or restore a compatible backup. For a disposable cache, back up the data directory, remove the incompatible dump file, and restart Redis:
Removing
/var/lib/redis/dump.rdbdeletes the persisted Redis dataset for that instance. Use this path only for disposable cache data or after taking a backup you know you can restore.
sudo systemctl stop redis
sudo cp -a /var/lib/redis "$HOME/redis-backup-$(date +%F-%H%M%S)"
sudo rm -f /var/lib/redis/dump.rdb
sudo systemctl start redis
systemctl is-active redis
active
Update or Remove Valkey or Redis from Rocky Linux
DNF handles routine updates for AppStream, EPEL, and Remi packages. Remove only the package family you installed. Package removal stops new binaries and services, while the optional cleanup commands remove local configuration, logs, and database files.
Update Valkey or Redis
Refresh metadata and apply available package updates through DNF:
sudo dnf upgrade --refresh
When Redis came from a module stream, check the stream list before expecting a major branch change. An explicitly enabled stream is marked with [e]; if no stream is enabled, DNF uses the default stream for that Rocky release.
dnf module list redis
Remove Valkey
Stop the service and remove the package:
sudo systemctl stop valkey
sudo dnf remove valkey
After DNF finishes, verify the installed package state:
rpm -q valkey > /dev/null 2>&1 || echo "valkey package is not installed"
valkey package is not installed
The next block permanently deletes Valkey configuration, logs, and data under
/etc/valkey,/var/log/valkey, and/var/lib/valkey. It copies the data directory first when that directory exists.
if [ -d /var/lib/valkey ]; then
sudo cp -a /var/lib/valkey "$HOME/valkey-backup-$(date +%F-%H%M%S)"
fi
sudo rm -rf /etc/valkey /var/lib/valkey /var/log/valkey
test ! -e /etc/valkey && test ! -e /var/lib/valkey && test ! -e /var/log/valkey && echo "Valkey files removed"
Valkey files removed
Remove Redis
For AppStream Redis, remove the main package:
sudo systemctl stop redis
sudo dnf remove redis
After DNF finishes, verify the installed package state:
rpm -q redis > /dev/null 2>&1 || echo "redis package is not installed"
redis package is not installed
For Remi Redis, include the optional Redis module packages if they were installed as weak dependencies:
packages=(redis redis-bloom redis-json redis-timeseries)
installed=()
for package in "${packages[@]}"; do
if rpm -q "$package" > /dev/null 2>&1; then
installed+=("$package")
fi
done
if ((${#installed[@]})); then
sudo systemctl stop redis 2>/dev/null || true
sudo dnf remove "${installed[@]}"
else
echo "No Redis packages are installed."
fi
Reset the Redis module stream when you no longer need a specific AppStream or Remi stream selected:
sudo dnf module reset redis -y
If you installed Remi only for Redis and no other packages use it, remove the Remi repository package as an optional source cleanup step. Leave EPEL and CRB or PowerTools in place when other packages on the server still depend on them.
if rpm -q remi-release > /dev/null 2>&1; then
sudo dnf remove remi-release
fi
After DNF finishes, confirm that Remi repository IDs and repo files are gone:
dnf repolist --enabled | grep -E '^remi-' || echo "Remi repositories are not enabled"
mapfile -t remi_repo_files < <(find /etc/yum.repos.d -maxdepth 1 -name 'remi*.repo' -print)
if ((${#remi_repo_files[@]})); then
printf '%s\n' "${remi_repo_files[@]}"
else
echo "Remi repo files are removed"
fi
Remi repositories are not enabled Remi repo files are removed
If EPEL and CRB or PowerTools were enabled only for Redis, and no other packages on the server use them, remove or disable those companion sources as well:
if rpm -q epel-release > /dev/null 2>&1; then
sudo dnf remove epel-release
fi
case "$(rpm -E %rhel)" in
8)
sudo dnf config-manager --set-disabled powertools
;;
9|10)
sudo dnf config-manager --set-disabled crb
;;
esac
Remove the Optional Sysctl Drop-In
If you created the memory-overcommit drop-in only for this cache service, remove it after uninstalling Valkey or Redis. Keep the file when another service on the server depends on vm.overcommit_memory = 1.
if [ -f /etc/sysctl.d/99-redis.conf ]; then
sudo rm -f /etc/sysctl.d/99-redis.conf
echo "Redis sysctl drop-in removed"
else
echo "Redis sysctl drop-in was not present"
fi
Redis sysctl drop-in removed
The next block permanently deletes Redis configuration, logs, and data. It copies the data directory first when that directory exists.
if [ -d /var/lib/redis ]; then
sudo cp -a /var/lib/redis "$HOME/redis-backup-$(date +%F-%H%M%S)"
fi
sudo rm -rf /etc/redis /etc/redis.conf /etc/redis-sentinel.conf /var/lib/redis /var/log/redis
test ! -e /etc/redis && test ! -e /etc/redis.conf && test ! -e /etc/redis-sentinel.conf && test ! -e /var/lib/redis && test ! -e /var/log/redis && echo "Redis files removed"
Redis files removed
Conclusion
Valkey or Redis is now available on Rocky Linux with the correct service name, configuration path, and package source for your release. Keep localhost-only access for single-server apps, add source-limited firewalld rules for remote clients, and use PHP on Rocky Linux or Nginx Mainline on Rocky Linux when building the rest of the web stack.


Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed in published comments:
<code>command</code>command<strong>bold</strong><em>italic</em><blockquote>quote</blockquote>