How To Install Redis on Fedora 45

Install Redis on Fedora 45

Anyone who types sudo dnf install redis on a fresh Fedora 45 box and expects the original Redis server is in for a surprise. The command works, and redis-cli works. The server that answers on port 6379 is Valkey, though. Fedora dropped the Redis package after the 2024 license change, and its redis name now resolves to a compatibility package. That catches people out on staging servers, in Ansible roles and in container build scripts.

This is less alarming than it sounds. Valkey is the Linux Foundation fork of the last BSD-licensed Redis. It speaks the same RESP protocol, so Python, Go, PHP and Node clients connect unchanged. Still, “it works” and “I know what is running in production” are different things. A cache, session store or job queue deserves a deliberate choice.

This guide covers both paths. The first is the Fedora-native route, Valkey with Redis command names. The second is real Redis 8 from Remi’s repository, for teams that need it. Along the way it covers service management, authentication, firewall rules, kernel tuning, persistence, monitoring and the errors that tend to show up at 2 AM. Commands target Fedora 45 with DNF 5. Most of the configuration carries over to Ubuntu, Debian and AlmaLinux, and the differences are noted where they matter.

Redis, Valkey and Fedora 45: What You Get

Why the package changed

Redis moved to non-open-source licenses (RSALv2 and SSPLv1) with version 7.4. Fedora then replaced Redis with Valkey, starting in Fedora 41. Redis 8 later added AGPLv3 as a licensing option, so it is open source again. Fedora has not switched back. Fedora 45 ships Valkey 9.1.x in its main repositories.

Choosing a path

Method Package source Service unit Best fit
Valkey with Redis compatibility Fedora repos: valkey, valkey-compat-redis valkey.service Apps that only need the Redis protocol
Redis 8 from Remi Remi modular repo redis.service Apps that need Redis-only features or modules

The compatibility package provides the name redis, and it holds symlinks plus a migration script. It fixes command names only. It does not make Valkey into Redis.

If your application only needs GET, SET, hashes, sorted sets, streams, pub/sub and Lua scripts, take the Fedora route. You get security updates through the normal channel. If your vendor documentation names Redis 8 specifically, or you depend on Redis-only modules, use the Remi route. Check the AGPLv3 terms with whoever handles your legal review before shipping it in a product.

Prerequisites

Before touching anything, confirm the basics:

cat /etc/fedora-release
sudo dnf check-update
sudo dnf upgrade --refresh -y

Reboot if the kernel was updated. Then check whether anything is already listening on 6379:

sudo ss -tulpn | grep 6379

An empty result is what you want. If something answers, you may have a container or an old install, and the troubleshooting section covers that.

Install Valkey with Redis Compatibility

This is the method most Fedora 45 servers should use.

Step 1: Install the packages

sudo dnf install -y valkey valkey-compat-redis

Fedora’s own documentation shows the same pairing: valkey for the server, and valkey-compat-redis for symlinked redis-cli and redis-server binaries. Asking for redis alone also pulls in both packages. Naming the packages explicitly makes ownership clearer in scripts and audit logs.

Step 2: Start and enable the service

sudo systemctl enable --now valkey
sudo systemctl status valkey --no-pager

The --now flag enables the unit at boot and starts it in one go. The compatibility package also provides a redis.service name, according to one hands-on review. Use valkey.service in your own documentation, though. It names what actually runs.

Step 3: Test it

redis-cli ping

A reply of PONG means the server is up. Try a round trip:

redis-cli set deploy:test "ok" EX 30
redis-cli get deploy:test
redis-cli info server | head -n 20

Don’t be surprised if INFO reports a Redis-style version such as 7.2.4. Valkey does this deliberately, so old client libraries that check the version string keep working. Look for the valkey_version field to see the real version.

Install Redis 8 from Remi’s Repository

Some teams need the real thing. Remi’s repository publishes Redis 8 for Fedora and Enterprise Linux 8 and newer. Always check the current stream on the Remi blog before pinning a version, because the version numbers there move.

Step 1: Add the repository

sudo dnf install https://rpms.remirepo.net/fedora/remi-release-45.rpm

Fedora 45 uses DNF 5, and Remi’s instructions for DNF 5 use the module syntax shown below. Download the RPM and verify it before installing on a hardened system. Remi’s own site documents the checksum and signing key.

Step 2: Enable the module and swap packages

sudo dnf module enable redis:remi-8.0
sudo dnf install redis --allowerasing

Remi notes that you may have to remove the valkey-compat-redis package first, since both claim the redis name. The --allowerasing flag lets DNF resolve that conflict. Read the transaction summary before confirming. On a server holding data, stop and back up first.

Step 3: Start the service

sudo systemctl enable --now redis
redis-cli info server | grep redis_version

Run one engine or the other on a given port. Running both is possible only on different ports, and it is almost never worth the confusion.

Moving an Existing Redis Install to Valkey

Upgrading an older Fedora machine that already runs Redis? The compatibility package handles most of the move. Fedora Magazine’s walkthrough installs it with the erase flag, which removes Redis and puts Valkey in its place:

sudo dnf install valkey-compat-redis --allowerasing

Take a snapshot first, whatever the docs promise:

redis-cli bgsave
sudo cp /var/lib/redis/dump.rdb /root/dump.rdb.$(date +%F)

Check the real data directory with redis-cli config get dir. Paths differ by packaging. After the swap, compare key counts with redis-cli dbsize before and after. A mismatch means the migration did not carry the data you assumed.

Configure for Real Workloads

Defaults are meant for a laptop. A production server needs a few decisions made up front.

Locate the config file

Valkey on Fedora keeps its configuration under /etc/valkey/. Confirm with:

rpm -qc valkey

Redis from Remi uses /etc/redis/redis.conf. The directives below are the same in both. Back the file up before editing:

sudo cp /etc/valkey/valkey.conf /etc/valkey/valkey.conf.orig

Bind address and protected mode

Most public Redis breaches start with one mistake, a server listening on a public interface with no password. Keep it on loopback unless clients really are remote:

bind 127.0.0.1 -::1
protected-mode yes
port 6379

The Fedora Valkey package has been reported to listen on loopback only by default. Verify it yourself with ss -tlnp. Trust nothing you have not checked.

If an app server on a private network needs access, add that private address to bind, for example bind 127.0.0.1 10.0.0.5. Never use 0.0.0.0 without both a firewall and authentication.

Authentication with ACLs

The old requirepass directive still works, but ACLs are better. They let each application have its own user with limited commands and key patterns.

user default off
user appcache on >UseAStrongGeneratedSecretHere ~app:* +@read +@write +@connection -@dangerous

Generate the secret instead of inventing one:

openssl rand -base64 32

Restart and test:

sudo systemctl restart valkey
redis-cli --user appcache --pass 'YourSecret' ping

Passing a password on the command line leaves it in shell history and the process list. For anything beyond a quick test, use the REDISCLI_AUTH environment variable or an interactive AUTH.

Memory limits and eviction

An unbounded Redis instance eventually meets the kernel’s OOM killer. Set a ceiling:

maxmemory 2gb
maxmemory-policy allkeys-lru

The right policy depends on what you store. For a pure cache, allkeys-lru or allkeys-lfu is the usual pick. For sessions or queues where losing keys hurts, use noeviction and monitor memory instead, so writes fail loudly rather than silently dropping data. Leave headroom: on a 4 GB host, maxmemory 2gb or 2.5 GB is sensible, because fork-based persistence can briefly raise memory use.

Persistence: RDB, AOF or neither

  • RDB snapshots are compact and fast to restore, but you can lose minutes of writes.
  • AOF logs each write, and appendfsync everysec is the usual balance between safety and speed.
  • No persistence is fine for a pure cache that can be rebuilt.

A typical mixed setup:

save 900 1
save 300 100
appendonly yes
appendfsync everysec

Put the data directory on fast storage. An AOF rewrite on a slow, shared disk can cause latency spikes that look like application bugs.

Kernel and System Tuning

This is the part generic tutorials skip, and it causes most real-world latency complaints.

Overcommit memory

Background saves use fork(). Without overcommit, a fork on a large dataset can fail even when memory is available.

echo 'vm.overcommit_memory = 1' | sudo tee /etc/sysctl.d/99-redis.conf
sudo sysctl --system

Transparent Huge Pages

THP can add latency spikes during saves. Check it:

cat /sys/kernel/mm/transparent_hugepage/enabled

If it shows [always], set it to madvise or never. Use a small systemd unit or a tuned profile to make the setting persist across reboots, because writing to /sys directly does not survive a restart.

Connection backlog

echo 'net.core.somaxconn = 1024' | sudo tee -a /etc/sysctl.d/99-redis.conf
sudo sysctl --system

Match tcp-backlog in the Redis config to this value. During a traffic spike, a short backlog drops connections before the app even sees an error.

File descriptors

For many clients, raise the limit with a systemd drop-in rather than editing /etc/security/limits.conf, which does not apply to services:

sudo systemctl edit valkey
[Service]
LimitNOFILE=65535

Then run sudo systemctl restart valkey. Match maxclients in the config to the limit.

CPU, disk and network

The engine is mostly single-threaded for command execution, so a faster core beats more cores. Pin it away from noisy neighbors if you share the host. Use SSDs or NVMe for AOF. Keep clients on the same low-latency network and use connection pooling, since opening a fresh TCP connection per request wastes more time than the actual command.

Security Hardening

Firewall

Fedora uses firewalld. If only local apps connect, open nothing. For a private network:

sudo firewall-cmd --permanent --new-zone=cache
sudo firewall-cmd --permanent --zone=cache --add-source=10.0.0.0/24
sudo firewall-cmd --permanent --zone=cache --add-port=6379/tcp
sudo firewall-cmd --reload

Restricting by source subnet beats opening 6379 globally. On Ubuntu and Debian, the equivalent is ufw allow from 10.0.0.0/24 to any port 6379.

SELinux

Leave SELinux enforcing. If you move the data directory, label it correctly instead of disabling the policy:

sudo semanage fcontext -a -t redis_var_lib_t "/data/redis(/.*)?"
sudo restorecon -Rv /data/redis

On Valkey the type may differ, so confirm with ls -Z /var/lib/valkey. Check ausearch -m avc -ts recent when a service fails to write after a path change.

Dangerous commands and TLS

Restrict FLUSHALL, CONFIG, DEBUG and KEYS through ACL categories. For traffic that crosses hosts, enable TLS with the tls-port, tls-cert-file, tls-key-file and tls-ca-cert-file directives. Plain-text Redis traffic on a shared network is easy to sniff.

Updates

Fedora’s Valkey stream gets security releases. The upstream 9.1.2 release was flagged with a security upgrade urgency. Subscribe to updates and apply them on a schedule:

sudo dnf upgrade --refresh

Running Redis in a Container

Some teams skip distro packages entirely and run the engine in Podman. This keeps the host clean and makes version pinning easier:

podman run -d --name cache -p 127.0.0.1:6379:6379 -v cache-data:/data docker.io/valkey/valkey:9

Binding the published port to 127.0.0.1 matters. Podman rootless usually avoids exposing the port, but explicit is better. For production, generate a systemd unit with Quadlet so the container restarts with the host.

Verify the Install Properly

Do not trust a single PONG. Run these checks:

redis-cli info memory | grep -E 'used_memory_human|maxmemory_human'
redis-cli info persistence | grep -E 'rdb_last_bgsave_status|aof_enabled'
redis-cli --latency-history -i 1
redis-cli slowlog get 10

For a rough benchmark:

redis-benchmark -q -n 100000 -c 50

Run benchmarks on a staging host, never on the live instance. They write junk keys and compete with real traffic.

Troubleshooting Common Errors

Unit redis.service not found

You probably installed Valkey and expected the old unit name. Run systemctl list-unit-files | grep -E 'redis|valkey'. Use valkey.service unless the compat package gave you an alias.

No match for argument: redis

Check that the repository metadata is current with sudo dnf clean all && sudo dnf makecache. If you enabled a Remi module, check dnf module list redis.

Conflicts when swapping packages

DNF reports a file or provides conflict between valkey-compat-redis and redis. That is expected, since both provide the same name. Use --allowerasing after you have backed up data.

Could not connect to Redis at 127.0.0.1:6379: Connection refused

Work through the list:

  1. Is the service running? systemctl status valkey
  2. Is it on the port you expect? ss -tlnp | grep 6379
  3. Did a config typo stop it? journalctl -u valkey -n 50 --no-pager

NOAUTH Authentication required

The server wants credentials and the client did not send them. Fix the client or the ACL. Do not disable authentication to make the error go away.

MISCONF Redis is configured to save RDB snapshots

A background save failed, so the server refuses writes. Usually the disk is full or the directory is not writable. Check df -h, directory ownership and SELinux denials. Fix the cause, then run redis-cli bgsave.

Can’t save in background: fork: Cannot allocate memory

Set vm.overcommit_memory = 1 as shown above. If the machine really is short on RAM, lower maxmemory.

Latency spikes every few minutes

Suspect THP, an AOF rewrite on slow disk, or a big KEYS * call. Use redis-cli --latency and slowlog to find which. Replace KEYS with SCAN in application code.

Port already in use

Run sudo ss -tulpn | grep 6379 to see which process owns it. A leftover container or a second instance is the usual cause.

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.

Related Posts