RackNerd Billboard Banner

How To Speed Up DNF Package Manager In Fedora, RHEL, CentOS, AlmaLinux, Rocky Linux

If you’re using a Red Hat-based distribution like Fedora, RHEL, CentOS, AlmaLinux, or Rocky Linux, you’ve probably used the DNF package manager. It’s powerful, but it’s not always fast. The good news is, with a few tweaks, you can make DNF faster and more responsive.

Here’s how to speed up DNF on your system.


1. Enable Fastestmirror Plugin

DNF has a plugin called fastestmirror that selects the fastest mirror automatically based on your location and connection. It’s usually installed by default, but not always enabled.

To enable it:

sudo nano /etc/dnf/dnf.conf

Add or edit the following line:

fastestmirror=True

Save and exit. This ensures DNF uses the mirror with the best speed.


2. Increase Parallel Downloads

By default, DNF downloads packages one at a time. You can speed things up by allowing multiple downloads in parallel.

In the same /etc/dnf/dnf.conf file, add:

max_parallel_downloads=10

You can go higher depending on your internet speed and system resources, but 10 is a good starting point.


3. Keep Cache Enabled

If you reinstall packages often or have limited bandwidth, keeping the cache can help.

In dnf.conf, add:

keepcache=True

This keeps downloaded packages instead of deleting them after installation. It saves time if you reinstall or install the same packages on multiple systems.


4. Disable Metadata Expiration (Optional)

By default, DNF checks for repo metadata updates frequently. You can reduce how often this happens, though it may delay seeing new package updates.

Add this to dnf.conf:

metadata_timer_sync=86400

This sets DNF to refresh metadata once a day instead of every time you run a command. Use with caution if you need real-time updates.


5. Clean Up Old or Broken Repos

Sometimes slowdowns happen because DNF is waiting on unreachable or broken repositories. Check your .repo files in /etc/yum.repos.d/ and disable or remove any that are outdated or unused.

To disable a repo:

sudo dnf config-manager --set-disabled [repo-id]

6. Use Delta RPMs Wisely

Delta RPMs download only the changes between package versions, which saves bandwidth but can slow down the process on slower CPUs because they require rebuilding packages locally.

To disable Delta RPMs:

sudo nano /etc/dnf/dnf.conf

Add:

deltarpm=False

If you care more about speed than saving bandwidth, turn this off.


Final Example of Optimized dnf.conf

Here’s what your /etc/dnf/dnf.conf might look like after optimization:

fastestmirror=True
max_parallel_downloads=10
keepcache=True
metadata_timer_sync=86400
deltarpm=False

Wrapping Up

With these changes, you should see noticeable improvements in DNF’s speed, especially when updating or installing packages. It’s a small tweak that pays off every time you use your system.

Have a favorite DNF tweak or want to share your results? Drop a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

RackNerd Billboard Banner
Copy link