How to Increase DNF Speed on Rocky Linux 9/8

DNF (Dandified Yum) is the package manager for RPM-based distributions, including Rocky Linux. While DNF is efficient and reliable, there are times when you might want to increase its speed, especially when dealing with numerous or large packages. Optimizing DNF can save you time and improve your overall system performance.

The following guide will demonstrate various techniques to increase DNF speed on Rocky Linux 9 or 8. These methods include adjusting DNF configuration settings, utilizing faster mirrors, and enabling caching to enhance your package management experience.

Open DNF Package Manager Configuration File

Accessing the Configuration File

Access the main configuration file to begin configuring the DNF package manager for enhanced performance. This file contains settings that dictate how DNF operates. Use the command line to open this file with a text editor.

Here, nano is used for its simplicity, but any text editor will suffice. Enter the following command in your terminal:

sudo nano /etc/dnf/dnf.conf

This command elevates your permissions using sudo, ensuring you have the necessary rights to modify the file. The /etc/dnf/dnf.conf path directs to the DNF configuration file.

Configure Parallel Downloads

Setting Up Parallel Downloads

Enhancing DNF speed on Rocky Linux involves optimizing the download process. A key method is enabling parallel downloads. This feature allows multiple packages to be downloaded simultaneously, significantly speeding up the update and installation processes.

Implementation in dnf.conf

To activate parallel downloads, you need to edit the dnf.conf configuration file. At the bottom of this file, add the following line:

max_parallel_downloads=10

This line instructs the DNF package manager to download up to ten packages concurrently. Ten is an optimal starting point for most systems, balancing speed and system resource usage.

Adjusting the Download Limit

While the initial setting of ten parallel downloads works well for most users, you might consider adjusting this number based on your system’s capabilities and network bandwidth. Incremental increases, such as changing from 10 to 15 or 20, can be tested to find the sweet spot for your setup.

Caution Against Excessive Parallel Downloads

It’s essential to exercise caution when increasing the number of parallel downloads. Setting this number too high (for example, to 100) can paradoxically decrease performance. This is due to the increased load on your system’s resources and potential network constraints. Starting with a moderate number like ten and then gradually increasing, it allows you to observe the impact on performance and make informed adjustments.

Configure Fastest Mirror

Enabling the Fastest Mirror Feature

To complement parallel downloads, activating the fastest mirror option in DNF significantly enhances download speed. This feature enables DNF to automatically select the fastest available mirror for downloading packages, optimizing download efficiency.

Editing the dnf.conf File

Underneath the parallel downloads setting in the dnf.conf file, add the following line to enable the fastest mirror:

fastestmirror=True

This addition directs DNF to prioritize the most efficient mirror, reducing the time taken for package downloads.

Saving the Configuration

After adding this line, save your changes to the dnf.conf file by pressing CTRL+O and exit the editor with CTRL+X. This action ensures that your settings are stored and will be applied in future DNF operations.

Testing the Configuration with DNF Update

To see the effects of your configuration changes, run a DNF update:

sudo dnf update --refresh

This command updates the package index and refreshes the repository metadata. During this process, DNF will display the selected fastest mirrors in the output, allowing you to verify that the setting is in effect.

Observing the Impact

Depending on the number of parallel downloads set earlier, the initial mirror selection might take a moment. However, this is a one-time process. Once the optimal mirrors are determined, subsequent DNF operations will be noticeably faster.

Enabling the fastest mirror and configuring parallel downloads should significantly improve your DNF package management speed on Rocky Linux 9 or 8.

Additional Configurations for DNF

Enhancing the performance and security of the DNF package manager on Rocky Linux involves more than just enabling parallel downloads and fastest mirrors. Several other settings in the dnf.conf file can further optimize the efficiency and safety of your package management process.

Enabling GPG Check for Package Security

Setting gpgcheck=1

gpgcheck=1

This command activates GPG (GNU Privacy Guard) signature verification for all packages. With this setting, DNF ensures that each package is authenticated and unaltered, maintaining system security and integrity.

Limiting Installed Package Versions

Configuring installonly_limit=3

installonly_limit=3

This setting restricts the system to keep only three versions of any installable package, effectively managing disk space. It’s especially beneficial for kernel updates, where older versions can accumulate and consume significant storage.

Automatic Cleanup of Unneeded Dependencies

Activating clean_requirements_on_remove=True

clean_requirements_on_remove=True

When set to True, this option commands DNF to automatically remove packages that were installed as dependencies but are no longer required by any installed packages. It ensures a cleaner system by eliminating redundant packages.

Handling Package Installation Issues

Using best=False

best=False

With this option, DNF attempts to proceed with transactions even if it cannot install the latest version of a package due to dependencies. This can be particularly useful for maintaining system stability.

Skipping Unavailable Packages

Implementing skip_if_unavailable=True

skip_if_unavailable=True

This configuration enables DNF to bypass packages that are not available or cannot be downloaded, preventing the failure of the entire update or installation process due to individual package issues.

Optimizing Updates with Delta RPMs

Enabling deltarpm=true

deltarpm=true

This setting instructs DNF to use delta RPMs, which download only the changes between installed and updated versions of a package. It can drastically reduce download sizes, benefiting those with limited bandwidth.

Conclusion

This guide covered how to boost DNF speed on Rocky Linux 9 or 8 by enabling parallel downloads, selecting the fastest mirror, and fine-tuning other settings for better performance and security. Start with setting parallel downloads to 10 and adjust based on your system’s capabilities. Regularly revisiting these configurations can keep your system efficient and responsive. Implementing these steps will streamline your package management and improve your Rocky Linux system’s functionality and security.

Leave a Comment