DNF, the default package manager for RPM-based distributions, plays a pivotal role in systems like Fedora, CentOS Stream, Red Hat Enterprise Linux (RHEL), and Rocky Linux. Enhancing DNF’s performance can be a game-changer for those aiming to optimize their package management tasks on Rocky Linux 9 or the older stable Enterprise Linux release of Rocky Linux 8. This guide will focus on how to increase DNF Speed, emphasizing boosting download speeds through parallel downloads and strategically selecting the fastest mirrors.
Key Steps to Enhance DNF Performance:
- Parallel Downloads: By enabling parallel downloads, DNF can fetch multiple packages simultaneously, significantly reducing the overall download time.
- Fastest Mirror Selection: Configuring DNF to select the fastest available mirrors automatically ensures that you’re sourcing packages from the most optimal locations, further accelerating download speeds.
By implementing these strategies, users can experience a more efficient and swift package management process, making system updates and software installations considerably faster.
Configure DNF Package Manager on Rocky Linux 9 or 8
The first step is to open the following configuration using the following command.
sudo nano /etc/dnf/dnf.conf
Configure Parallel Downloads on Rocky Linux
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.
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. My advice is to start small at ten and then raise the limit in the DNF package manager configuration file. Adding too many parallels may reduce performance if you add 100.
Configure Fastest Mirror on Rocky Linux
The second improvement alongside parallel downloads is to enable the fastest mirror.
Add the following underneath parallel downloads in the dnf.conf configuration file.
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 is now determining the fastest mirrors in the output.
sudo dnf update --refresh
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.
For users who find this has not helped, you must diagnose the issue further. The above settings work best when you have 50 to 300 packages to update, which should be incredibly fast with the fastest mirror downloading the packages at the best bandwidth rate possible along with utilizing parallel downloads, so you are not downloading each package one by one, which is the biggest culprit in slowing down DNF in my opinion.