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

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

Increase package download speed using DNF package manager in RPM-based systems

By sk
Published: Updated: 107.5K views

If you're experiencing slow package downloads or updates, here is a workaround to speed up DNF package manager in Fedora, RHEL and its clones such as CentOS, AlmaLinux and Rocky Linux.

This guide is officially tested in Fedora, however it should work in all RHEL-based systems that uses DNF as their default package manager.

Introduction

As you already know, DNF is the default package manager for Fedora 25 and newer versions, RHEL 8 and its clone CentOS 8, AlmaLinux 8, and Rocky Linux 8.

The other day I decided to try Fedora 36. I downloaded the Fedora 36 Vagrant box and run it with Oracle Virtualbox. The first thing I noticed after trying Fedora 36 is that the DNF package manager is terribly slow.

I thought DNF might perform slow when it updates the repositories and metadata for the first time. But, it was still slow in the subsequent times. After a couple web searches, I found a solution that worked for me.

Speed up DNF Package Manager in Fedora, RHEL and its Clones

We can increase the download speed while installing packages using the DNF package manager by increasing the maximum number of simultaneous package downloads.

To do so, edit /etc/dnf/dnf.conf file:

$ sudo nano /etc/dnf/dnf.conf

Add the following line to enable DNF parallel downloads:

max_parallel_downloads=10
Speed Up DNF Package Manager In Fedora Linux
Speed Up DNF Package Manager In Fedora Linux

This option tells the DNF to use 10 parallel downloads at the same time. You can increase or decrease this value as per your wish. The default value for max_parallel_downloads option is 3. Press CTRL+O to save the changes and press CTRL+X to exit.

Now try to perform any package operation with DNF command. You will notice the speed difference while downloading the packages.

Choose fastest mirror

The another option to speed up DNF is to select fastest mirror from the Fedora public mirrors. To do so, again edit the /etc/dnf/dnf.conf file:

$ sudo nano /etc/dnf/dnf.conf

Add the following line:

fastestmirror=True

Press CTRL+O followed by CTRL+X to save the file and exit.

Now I can see a noticeable difference when installing and updating packages with DNF in my Fedora 38 virtual machine.

In my experience, DNF takes longer time to download metadata than to download a package. This is because Fedora metadata is larger than the other package manager's. So I guess DNF is slow only when updating the repository metadata. After that, it works smoothly.

You May Also Like

2 comments

Nasif Munawar November 11, 2022 - 7:57 pm

Thank you very much for writing this article. You just saved a lot of time of mine. I will remember this help forever. I wish you best of luck for whatever your aim in life is. May God bless you.

Reply
redflagrun December 8, 2022 - 2:27 pm

Thanks Mate

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More