How to Increase DNF Speed on Rocky Linux EL9 or EL8

This guide will demonstrate how to increase DNF (Dandified YUM) speed on Rocky Linux, specifically for versions 9 and 8. Optimizing the DNF speed is essential for a more efficient system management experience. This process involves several steps that ensure faster package installation and updates, a key aspect for users who rely on Rocky Linux for their daily operations.

Key Features to Enhance DNF Speed:

  • Configuring Fastest Mirror: Ensuring DNF automatically selects the quickest mirror for downloading packages.
  • Parallel Downloads: Enabling multiple simultaneous downloads to reduce waiting time.
  • Cache Optimization: Streamlining cache usage to avoid unnecessary downloads.
  • Delta RPMs Utilization: Applying delta RPMs to update only the changed parts of packages, significantly reducing download size.

This guide will walk you through these optimizations in a straightforward manner. While technical in nature, the steps are presented clearly, making them accessible even to those new to Linux system administration. The focus will be on practical application, providing you with immediate results in your system’s performance.

Open DNF Package Manager Configuration File on Rocky Linux 9 or 8

Accessing the Configuration File

To begin configuring the DNF package manager for enhanced performance, access the main configuration file. 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 on Rocky Linux 9 or 8

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 important 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 on Rocky Linux 9 or 8

Enabling 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.

Finding Fastest DNF Mirror Host on Rocky Linux EL9/EL8.
A visual tutorial on selecting the most optimal DNF mirror host for Rocky Linux.

By enabling the fastest mirror and configuring parallel downloads, your DNF package management speed on Rocky Linux 9 or 8 should experience a significant improvement.

Additional Configurations for DNF on Rocky Linux 9 or 8

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

In conclusion, this guide has provided a comprehensive overview of how to boost DNF speed on Rocky Linux EL9 or EL8. We delved into key configurations like enabling parallel downloads and selecting the fastest mirror, as well as fine-tuning additional settings for optimal performance and security. Remember, start with the recommended settings, such as setting parallel downloads to 10, and adjust as needed based on your system’s capabilities. Regularly revisiting these configurations can ensure that your system remains efficient and responsive. Implementing these steps will not only streamline your package management process but also enhance the overall functionality and security of your Rocky Linux system.

Leave a Comment