FedoraRHEL Based

How To Install Redis on Fedora 43

Install Redis on Fedora 43

Redis is a powerful open-source, in-memory data structure store that serves as a high-performance database, cache, and message broker. Its ability to handle millions of requests per second while maintaining sub-millisecond latency makes it an essential tool for modern web applications, real-time analytics platforms, session management systems, and distributed architectures. Redis supports complex data structures including strings, hashes, lists, sets, sorted sets, bitmaps, and hyperloglogs, offering developers tremendous flexibility in solving diverse computational challenges.

Installing Redis on Fedora 43 is straightforward thanks to the distribution’s robust package management system. Whether you’re building a caching layer for your web application, implementing a message queue, or creating a real-time leaderboard system, Redis delivers exceptional performance with minimal resource overhead. This comprehensive guide walks you through multiple installation methods, configuration best practices, security hardening techniques, and troubleshooting strategies to ensure your Redis deployment runs smoothly.

Throughout this tutorial, you’ll learn how to install Redis using Fedora’s default AppStream repository or the Remi RPM repository for access to specific versions. We’ll cover essential configuration options, implement security measures, test functionality, and optimize performance for production environments.

Prerequisites

Before beginning the Redis installation process, ensure your system meets the following requirements:

  • A running Fedora 43 installation with root or sudo privileges
  • Basic familiarity with Linux command-line operations
  • Terminal access via local console or SSH connection
  • Active internet connection for downloading packages
  • Minimum 2GB RAM for optimal Redis operation (1GB absolute minimum)
  • Updated system packages to prevent dependency conflicts

Optional but recommended for production deployments include a static IP address, firewall configuration knowledge, and a backup strategy for data persistence files.

Understanding Redis on Fedora 43

Fedora’s package management ecosystem provides Redis through the default AppStream repository, making installation simple with the DNF package manager. The AppStream version typically offers stable, well-tested releases that integrate seamlessly with Fedora’s system architecture. However, developers requiring specific Redis versions or cutting-edge features may prefer the Remi RPM repository, which maintains multiple Redis version streams including 6.0, 6.2, 7.0, 7.2, and 7.4.

The choice between installation methods depends on your project requirements. AppStream provides excellent stability for general-purpose deployments, while Remi offers version flexibility for applications with specific compatibility needs or teams wanting access to the latest Redis capabilities and performance improvements.

Method 1: Install Redis via Default AppStream Repository

This method provides the quickest path to a working Redis installation using Fedora’s native package repositories.

Step 1: Update Fedora System

System updates prevent package conflicts and ensure all dependencies install correctly. Open your terminal and execute:

sudo dnf upgrade --refresh

This command refreshes repository metadata and upgrades all installed packages to their latest versions. The process typically takes 2-5 minutes depending on your system’s current state and internet speed. Enter your sudo password when prompted.

Step 2: Install Redis Package

Once your system is current, install Redis with a single command:

sudo dnf install redis -y

DNF automatically resolves dependencies and installs the Redis server, command-line interface, and required libraries. The -y flag automatically confirms the installation, eliminating interactive prompts. Expect approximately 2-3MB of packages to download.

The installation places the Redis server binary at /usr/bin/redis-server, the command-line client at /usr/bin/redis-cli, and configuration files in /etc/redis/. The data directory defaults to /var/lib/redis/.

Step 3: Start and Enable Redis Service

Fedora uses systemd for service management. Activate Redis immediately and configure it to start automatically at boot:

sudo systemctl enable --now redis

The enable flag configures automatic startup, while --now starts the service immediately without requiring a separate command. This efficient approach saves time and ensures consistency.

Verify the service status:

systemctl status redis

A successful start displays “active (running)” in green text, along with recent log entries showing Redis initialization. Press ‘q’ to exit the status view.

Step 4: Verify Redis Installation

Confirm Redis is listening on the default port 6379:

ss -antpl | grep redis

The output should display Redis bound to 127.0.0.1:6379 or [::1]:6379, indicating localhost connectivity. Alternatively, check the running process:

ps aux | grep redis

Test functionality using the Redis command-line interface:

redis-cli ping

A successful connection returns PONG, confirming Redis is operational and responding to commands.

Method 2: Install Redis via Remi RPM Repository

The Remi repository provides access to multiple Redis versions, allowing precise version selection for compatibility or feature requirements.

When to Use Remi Repository

Choose Remi when you need specific Redis versions for application compatibility, want access to the latest features before they reach AppStream, require long-term support versions, or need to match development and production environments precisely.

Step 1: Import Remi RPM Repository

Add the Remi repository to your Fedora 43 system:

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

This command downloads and installs the Remi repository configuration, enabling access to additional Redis packages. The repository includes GPG keys for package verification, ensuring authenticity and security.

Step 2: List Available Redis Modules

View all Redis versions available through Remi:

sudo dnf module list redis

The output displays multiple module streams with names like redis:remi-7.2, redis:remi-7.4, etc. Each stream represents a specific Redis major version with ongoing updates and patches.

Step 3: Enable Specific Redis Version

Select and enable your preferred Redis version. For Redis 7.2:

sudo dnf module enable redis:remi-7.2 -y

Module enabling configures DNF to prioritize the specified version stream. If you need to switch versions later, reset the module first:

sudo dnf module reset redis -y

Then enable your desired version.

Step 4: Install Redis from Remi

With the module enabled, install Redis:

sudo dnf install redis -y

DNF installs the version from your enabled module stream. Verify the installed version:

redis-server --version

Step 5: Start and Enable Service

Activate the Redis service using the same systemd commands:

sudo systemctl enable --now redis

Verify operation:

systemctl status redis

Configuring Redis on Fedora 43

Proper configuration optimizes performance, enhances security, and aligns Redis behavior with your application requirements.

Understanding Redis Configuration File

Redis configuration resides in /etc/redis/redis.conf. Before making changes, create a backup:

sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.backup

Open the configuration file with your preferred text editor:

sudo nano /etc/redis/redis.conf

The configuration file contains extensive comments explaining each directive.

Basic Security Configuration

Setting Password Authentication

Locate the requirepass directive (approximately line 507) and uncomment it:

requirepass YourStrongPassword123!

Replace with a complex password combining uppercase, lowercase, numbers, and special characters. Password authentication prevents unauthorized access to your Redis instance.

Network Binding

By default, Redis binds to localhost (127.0.0.1 and ::1), accepting only local connections. This configuration provides excellent security for applications running on the same server. The bind directive appears near line 60:

bind 127.0.0.1 ::1

For remote access, specify your server’s IP address:

bind 192.168.1.100

Never use bind 0.0.0.0 in production environments as it exposes Redis to all network interfaces, creating significant security vulnerabilities.

Disabling Dangerous Commands

Protect against accidental data loss by renaming or disabling critical commands:

rename-command FLUSHDB ""
rename-command FLUSHALL ""
rename-command CONFIG "MySecretConfig"

Empty quotes disable commands entirely, while custom names require knowledge to execute.

Memory and Performance Settings

Maximum Memory Allocation

Specify Redis’s memory limit to prevent system resource exhaustion:

maxmemory 500mb

Adjust based on available RAM and application requirements. Redis stops accepting writes when reaching this limit unless an eviction policy is configured.

Eviction Policies

Define what happens when memory limits are reached:

maxmemory-policy allkeys-lru

Policy options include:

  • allkeys-lru: Removes least recently used keys from all keys
  • volatile-lru: Removes least recently used keys with expiration set
  • allkeys-random: Randomly removes keys
  • volatile-ttl: Removes keys with shortest time-to-live
  • noeviction: Returns errors when memory limit reached

Choose based on your data access patterns and application tolerance for key eviction.

Persistence Configuration

Redis offers two persistence mechanisms for data durability: RDB snapshotting and AOF (Append Only File).

RDB (Redis Database) Snapshotting

RDB creates point-in-time snapshots of your dataset at specified intervals. Default configuration includes:

save 900 1
save 300 10
save 60 10000

These directives trigger snapshots after 900 seconds if 1 key changed, 300 seconds if 10 keys changed, or 60 seconds if 10,000 keys changed. Snapshots write to /var/lib/redis/dump.rdb.

RDB provides compact data files and faster restart times but risks losing data between snapshots. Customize intervals based on your durability requirements versus performance impact tolerance.

AOF (Append Only File)

AOF logs every write operation, providing better durability than RDB alone. Enable AOF:

appendonly yes
appendfilename "appendonly.aof"

Configure synchronization frequency:

appendfsync everysec

Options include always (maximum durability, significant performance impact), everysec (balanced approach, recommended for most use cases), and no (operating system controls flushing, fastest but least durable).

For critical data, enable both RDB and AOF. Redis uses AOF for recovery when both are present, providing comprehensive data protection.

After configuration changes, restart Redis:

sudo systemctl restart redis

Testing Redis Connection and Functionality

Basic Connection Test

Launch the Redis command-line interface:

redis-cli

If you configured password authentication, authenticate:

AUTH YourPassword

Successful authentication returns OK. Test the connection:

ping

The server responds with PONG.

Running Basic Redis Commands

String Operations

Store a key-value pair:

SET user:1000:name "John Doe"

Retrieve the value:

GET user:1000:name

Working with Lists

Create a list:

LPUSH tasks "Complete documentation"
LPUSH tasks "Review code"

View list contents:

LRANGE tasks 0 -1

Hash Operations

Store structured data:

HSET user:1001 name "Jane Smith" email "jane@example.com" age 28

Retrieve specific fields:

HGET user:1001 name

Setting Expiration

Auto-delete keys after a specified time:

SET session:abc123 "user_data"
EXPIRE session:abc123 3600

The key expires after 3600 seconds (1 hour).

Checking Server Information

View comprehensive server details:

INFO SERVER

Check memory usage:

INFO MEMORY

Monitor connected clients:

INFO CLIENTS

Review statistics:

INFO STATS

Exit the CLI by typing exit or pressing Ctrl+D.

Redis Benchmarking

Measure Redis performance using the built-in benchmarking tool:

redis-benchmark -q

For authenticated instances:

redis-benchmark -a YourPassword -h 127.0.0.1 -q

The output displays operations per second for common commands like PING, SET, GET, LPUSH, and LPOP. Higher numbers indicate better performance.

Advanced Benchmarking

Test specific operations with custom parameters:

redis-benchmark -a YourPassword -h 127.0.0.1 -n 100000 -c 20 -t SET,GET

Parameters:

  • -n 100000: Execute 100,000 requests
  • -c 20: Use 20 parallel connections
  • -t SET,GET: Test only SET and GET operations

Check latency:

redis-cli --latency

This displays ongoing latency measurements, helping identify performance issues or network problems.

Configuring Firewall for Redis

Secure Redis access by configuring firewall rules.

Creating Dedicated Firewall Zone

Create a Redis-specific zone:

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

Adding Firewall Rules

Allow access from specific IP addresses:

sudo firewall-cmd --permanent --zone=redis --add-source=192.168.1.50

Open the Redis port:

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

Reload firewall configuration:

sudo firewall-cmd --reload

Verify rules:

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

Add multiple clients by repeating the --add-source command with different IP addresses.

Testing Firewall Configuration

From an allowed client machine:

redis-cli -h your_server_ip -a YourPassword ping

A successful connection returns PONG. Denied connections timeout or receive connection refused errors.

Enabling Redis Service on Boot

Ensure Redis starts automatically after system reboots. Verify the service is enabled:

systemctl is-enabled redis

If the output shows “disabled,” enable it:

sudo systemctl enable redis

Test persistence by rebooting and checking service status afterward.

Common Troubleshooting

Service Won’t Start

Check service logs for error details:

sudo journalctl -u redis -n 50

Common issues include port conflicts, configuration syntax errors, or permission problems. Test configuration validity:

redis-server /etc/redis/redis.conf --test-config

SELinux may block Redis operations. Check for denials:

sudo ausearch -m avc -ts recent

Connection Issues

Verify Redis is listening:

sudo ss -tlnp | grep 6379

Check firewall rules allow connections. Ensure the bind address matches your connection source. Password authentication errors suggest incorrect passwords in the requirepass directive or client commands.

Performance Issues

Examine the slow query log:

SLOWLOG GET 10

This displays the ten slowest operations, helping identify performance bottlenecks. Monitor memory usage with INFO MEMORY. High memory usage may require increasing maxmemory limits or implementing eviction policies. CPU-intensive operations might benefit from Redis configuration tuning or code optimization.

Congratulations! You have successfully installed Redis. Thanks for using this tutorial for installing the Redis cache on your Fedora 43 Linux system. For additional help or useful information, we recommend you check the official Redis website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

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.
Back to top button