How to Install Redis on Fedora

Redis is a high-performance, in-memory data store widely used for caching, session management, real-time analytics, and message brokering. Starting with Fedora 41, the distribution replaced Redis with Valkey, an open source fork created after Redis changed its license to the non-FOSS Server Side Public License (SSPL). As a result, Valkey maintains full compatibility with Redis commands and protocols, so existing applications and configurations work without modification.

This guide covers two installation methods for Fedora: installing Valkey from the default repositories (recommended for most users) and installing Redis from the Remi RPM repository (for users who specifically need Redis rather than Valkey). Because both options provide the same in-memory data store functionality, either can serve as a drop-in replacement for Redis-based applications.

Choose Your Installation Method

Before proceeding, decide which package best fits your needs. The following table compares the available installation methods:

MethodChannelVersionUpdatesBest For
Valkey (DNF)Fedora ReposLatest stableAutomatic via dnf upgradeMost users who want the default FOSS-compatible option
Redis (Remi RPM)Remi Repository8.0, 8.2, 8.4Automatic via dnf upgradeUsers who specifically need Redis rather than Valkey

For most users, Valkey is recommended because it ships in the default Fedora repositories, requires no third-party configuration, and maintains full Redis protocol compatibility. Only install Redis from Remi if you have a specific requirement for Redis itself.

Update Fedora Before Installation

Before installing any new software, update your system packages to ensure you have the latest security patches and dependency versions. This step helps prevent conflicts during installation.

sudo dnf upgrade --refresh

In particular, this command refreshes the repository metadata and then upgrades all installed packages to their latest versions.

Method 1: Install Valkey via DNF (Recommended)

Valkey is available in the default Fedora repositories and provides the same functionality as Redis. Because Fedora includes compatibility symlinks, you can continue using familiar Redis commands like redis-cli and redis-server even though the underlying software is Valkey.

Install Valkey

To install Valkey along with the Redis compatibility package, run the following command:

sudo dnf install valkey

This command installs the Valkey server, CLI tools, and the valkey-compat-redis package that provides compatibility symlinks for Redis commands. Once the installation completes, both valkey-cli and redis-cli will be available, pointing to the same binary.

Verify Installation

Next, confirm the installation succeeded by checking the Valkey server version:

valkey-server --version

Expected output:

Valkey server v=8.1.5 sha=00000000:0 malloc=jemalloc-5.3.0 bits=64 build=3d220603f78e220d

Alternatively, you can use the Redis compatibility command:

redis-server --version

Similarly, this returns the same output because redis-server is a symlink to valkey-server.

Method 2: Install Redis via Remi RPM

If you specifically need Redis rather than Valkey, then the Remi RPM repository provides Redis packages for Fedora. This method installs the original Redis software from a trusted third-party repository.

Installing Redis from Remi will conflict with Valkey. If you have Valkey installed, remove it first with sudo dnf remove valkey valkey-compat-redis before proceeding.

Import Remi RPM Repository

First, add the Remi repository to your system. This repository provides various PHP versions, Redis, and other software packages maintained by Remi Collet.

sudo dnf install https://rpms.remirepo.net/fedora/remi-release-$(rpm -E %fedora).rpm -y

Specifically, this command automatically detects your Fedora version and then downloads the appropriate Remi repository configuration. The $(rpm -E %fedora) expression expands to your current Fedora release number (such as 42, 43, or 44).

List Available Redis Modules

Once the Remi repository is added, you can view the available Redis versions using DNF modules:

sudo dnf module list redis

Expected output:

Name  Stream   Profiles   Summary                            
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

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

In total, the Remi repository offers Redis 8.0, 8.2, and 8.4 streams. Therefore, choose the version that matches your application requirements.

Enable a Redis Version

Next, enable your preferred Redis version by specifying the stream name. For example, to enable Redis 8.4:

sudo dnf module enable redis:remi-8.4 -y

Subsequently, this command enables the Redis 8.4 module stream from the Remi repository.

Install Redis

Once the module stream is enabled, install Redis:

sudo dnf install redis -y

DNF will then install Redis from the enabled Remi module stream along with its dependencies.

Verify Installation

Finally, confirm the Redis installation by checking the version:

redis-server --version

Expected output:

Redis server v=8.4.x sha=00000000:0 malloc=jemalloc-5.3.0 bits=64 build=xxxxxxxxxxxxxxxx

Enable and Start the Service

After installation, you need to start the service and enable it to run automatically at boot. Importantly, the following instructions apply to both Valkey and Redis installations.

Start and Enable the Service

For Valkey installations, start and enable the Valkey service:

sudo systemctl enable valkey --now

Alternatively, for Redis installations from Remi, use the redis service name:

sudo systemctl enable redis --now

In particular, the --now flag starts the service immediately while also enabling it for automatic startup on boot.

If you installed Valkey with the compatibility package, the redis.service alias also works: sudo systemctl enable redis --now. Both commands point to the same Valkey service.

Verify Service Status

Then, confirm the service is running correctly:

systemctl status valkey

Expected output:

● valkey.service - Valkey persistent key-value database
     Loaded: loaded (/usr/lib/systemd/system/valkey.service; enabled; preset: disabled)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf
     Active: active (running) since Sun 2025-12-22 10:32:00 UTC; 5min ago
   Main PID: 1234 (valkey-server)
      Tasks: 5 (limit: 4644)
     Memory: 7.5M
        CPU: 125ms
     CGroup: /system.slice/valkey.service
             └─1234 /usr/bin/valkey-server 127.0.0.1:6379

Consequently, this output confirms the service is active and running, listening on the default port 6379.

Test the Connection

Additionally, verify the server responds to commands by connecting with the CLI and sending a PING command:

redis-cli ping

Expected output:

PONG

In other words, a PONG response confirms the server is accepting connections and functioning correctly.

View Server Information

Furthermore, to view detailed server information, connect to the CLI and run the INFO command:

redis-cli INFO SERVER

In particular, this command displays server version, uptime, connected clients, memory usage, and other operational details useful for monitoring and troubleshooting.

Configure Valkey or Redis

Both Valkey and Redis use similar configuration files with the same directive syntax. However, the configuration file location differs depending on which package you installed.

Configuration File Locations

First, open the configuration file with your preferred text editor:

For Valkey (default Fedora installation):

sudo nano /etc/valkey/valkey.conf

For Redis (Remi installation):

sudo nano /etc/redis/redis.conf

Configure Memory Limits

For caching use cases, therefore, set a maximum memory limit to prevent the server from consuming all available RAM. To do this, add or uncomment the following directives in the configuration file:

maxmemory 500mb
maxmemory-policy allkeys-lru

Specifically, the maxmemory directive sets the maximum memory limit (adjust based on your server’s available RAM). Meanwhile, the maxmemory-policy directive determines how the server handles memory when the limit is reached. The allkeys-lru policy removes the least recently used keys first, which therefore works well for caching scenarios.

Configure Network Binding

By default, Valkey and Redis bind to localhost (127.0.0.1) for security. If you need to allow connections from other hosts, then modify the bind directive.

Listen on all interfaces:

bind * -::*

Listen on a specific IP address:

bind 192.168.1.100

Security warning: Binding to all interfaces or external IP addresses exposes the server to network attacks. Unauthenticated Redis instances have been exploited for unauthorized data access and remote code execution. Always configure password authentication and firewall rules before exposing the server to a network.

Configure Password Authentication

To improve security, setting a password adds a layer of protection against unauthorized access. To do this, find the requirepass directive in the configuration file and then set a strong password:

requirepass YourStrongPassword123!

Choose a complex password with a mix of uppercase letters, lowercase letters, numbers, and special characters to resist brute-force attacks. For additional protection, consider setting up Fail2ban to block repeated failed authentication attempts.

Once you have set a password, authenticate when connecting with the CLI:

redis-cli -a YourStrongPassword123!

Or authenticate after connecting:

redis-cli
AUTH YourStrongPassword123!

Unauthenticated connection attempts will receive an error:

(error) NOAUTH Authentication required.

Configure Data Persistence

Notably, Valkey and Redis support two persistence methods: RDB snapshots and Append Only File (AOF).

RDB Snapshotting:

Specifically, the save directives configure automatic snapshots based on the number of changes within a time period:

save 900 1
save 300 10
save 60 10000

This configuration saves the dataset:

  • Every 900 seconds (15 minutes) if at least 1 key changed
  • Every 300 seconds (5 minutes) if at least 10 keys changed
  • Every 60 seconds if at least 10000 keys changed

Append Only File (AOF):

For higher durability, enable AOF to log every write operation:

appendonly yes

In contrast, AOF provides better data safety because it allows recovery from the most recent write operation, though it uses more disk I/O than RDB snapshots.

Apply Configuration Changes

After modifying the configuration file, save your changes and then restart the service to apply them:

For Valkey:

sudo systemctl restart valkey

For Redis:

sudo systemctl restart redis

Configure Firewall Rules

If you need to access Valkey or Redis from remote hosts, configure firewalld to allow connections on port 6379. This section creates a dedicated firewall zone for granular access control.

Create a Dedicated Firewall Zone

First, create a new zone specifically for Valkey or Redis traffic:

sudo firewall-cmd --permanent --new-zone=valkey

Allow Access from Specific IP Addresses

Next, add trusted IP addresses that should have access to the service:

sudo firewall-cmd --permanent --zone=valkey --add-source=192.168.1.100

Remember to replace 192.168.1.100 with your client’s IP address. Repeat this command for each IP that needs access.

Open the Service Port

Then, allow TCP traffic on the default port 6379:

sudo firewall-cmd --permanent --zone=valkey --add-port=6379/tcp

Apply Firewall Changes

Finally, reload the firewall to apply the new rules:

sudo firewall-cmd --reload

Expected output:

success

Verify Firewall Configuration

Afterward, confirm the zone is configured correctly:

sudo firewall-cmd --zone=valkey --list-all

Expected output:

valkey
  target: default
  icmp-block-inversion: no
  interfaces: 
  sources: 192.168.1.100
  services: 
  ports: 6379/tcp
  protocols: 
  forward: no
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules:

From a remote allowed host, test the connection:

redis-cli -h 192.168.1.50 ping

Remember to replace 192.168.1.50 with your Valkey or Redis server’s IP address. When successful, the connection returns PONG.

Remove Valkey or Redis

If you no longer need the installation, follow the appropriate steps for your installed package.

Remove Valkey

First, stop the service and remove the packages:

sudo systemctl stop valkey
sudo dnf remove valkey valkey-compat-redis

Warning: The following command permanently deletes all Valkey data files. Back up your data first if needed: sudo cp -r /var/lib/valkey ~/valkey-backup

Optionally, to remove configuration and data files:

sudo rm -rf /etc/valkey /var/lib/valkey /var/log/valkey /var/run/valkey

Then, verify the removal by checking that the command is no longer available:

which valkey-server

Expected output:

/usr/bin/which: no valkey-server in (/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin)

Consequently, this output confirms that Valkey has been completely removed from your system.

Remove Redis (Remi Installation)

First, stop the service and remove the packages:

sudo systemctl stop redis
sudo dnf remove redis
sudo dnf module reset redis

In addition, the module reset command clears the enabled module stream.

Warning: The following command permanently deletes all Redis data files. Back up your data first if needed: sudo cp -r /var/lib/redis ~/redis-backup

Optionally, to remove configuration and data files:

sudo rm -rf /etc/redis /var/lib/redis /var/log/redis /var/run/redis

Additionally, to remove the Remi repository and clean up:

sudo dnf remove remi-release
sudo dnf clean all

Finally, verify the removal by checking that the command is no longer available:

which redis-server

Expected output:

/usr/bin/which: no redis-server in (/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin)

Consequently, this output confirms that Redis and its associated packages have been completely removed from your system.

Conclusion

You now have a working Valkey or Redis installation on Fedora. Valkey provides the recommended path for most users because it maintains full Redis compatibility while using an open source license that aligns with Fedora’s principles. For users who specifically require Redis, the Remi repository offers current versions with straightforward installation. To build a complete web application stack, consider pairing your installation with PHP and Nginx for session caching and performance optimization. Regardless of which option you chose, regularly update your system with sudo dnf upgrade to receive security patches and new features.

Useful Links

For further reading, these resources provide additional information and documentation:

Leave a Comment