How to Increase DNF Speed on CentOS 9 Stream

CentOS 9 Stream users may notice that the DNF download speed is slow compared to other distributions, and this will be frustrating after you have to download and install many packages. Most users do not realize that some minor tweaks to some configuration files can increase your download speed immensely.

In the following tutorial, you will learn how to configure and increase your DNF package manager download, update or upgrade speed on CentOS 9 Stream workstation or server by adding and increasing parallel package downloads and mirror sources to find the fastest speed to get your packages from.

Situational – Remove DNF Subscription Manager

For users who encounter issues with “This system is not registered with an entitlement server. You can use subscription-manager to register,” then use the following command to remove the subscription manager as it is unnecessary for CentOS stream to receive updates, unlike RHEL.

sudo dnf erase subscription-manager -y

Example output:

How to Increase DNF Speed on CentOS 9 Stream

As mentioned above, all the subscription-based lockouts have been removed.

Update CentOS Stream

Before you continue, your system is advised to ensure all existing packages are up to date to avoid system conflicts during the installation and for good system maintenance.

sudo dnf upgrade --refresh -y

Configure DNF Package Manager

The first step is to open the following configuration using the following command.

sudo nano /etc/dnf/dnf.conf

Configure Parallel Downloads

The first option to increase the DNF speed is to add parallel downloads, and this option enabled will show results instantly after you allow it.

Add the following at the bottom of the dnf.conf configuration file.

max_parallel_downloads=10

The above tells the DNF package manager to download ten parallel packages at the same time, 10 is the most recommended setting to start with, but you can increase this but only do so sparingly, such as from 10 to 15, 15 to 20.

Configure Fastest Mirror

The second improvement alongside parallel downloads is to enable the fastest mirror.

Add the following underneath parallel downloads in the dnf.conf configuration file.

fastestmirror=True

Example:

How to Increase DNF Speed on CentOS 9 Stream

Now with the fastest mirror and parallel mirrors configured, save the configuration file CTRL+O and exit CTRL+X.

The good idea is to run a DNF upgrade, and you will notice first the DNF package manager now determining the fastest mirrors in the output.

sudo dnf update --fresh

Example:

How to Increase DNF Speed on CentOS 9 Stream

Depending on the number of parrel downloads, this may take a few moments to check and sort out, but in the long term, your DNF speeds should be incredibly faster now.

Comments and Conclusion

In the tutorial, you have learned how to increase the number of parallel downloads and configure the fastest mirror options in your CentOS 9 Stream workstation or server.

For users who find that this has not helped, you will need to diagnose the issue further. The above settings work best when you have 50 to 300 packages to update, and it should be incredibly faster.



Follow LinuxCapable.com!

Like to get automatic updates? Follow us on one of our social media accounts!