Kiến Thức Linux

DNF vs. YUM: Learn the Differences

DNF vs. YUM - learn the differences.

Introduction

DNF and YUM are package management tools used in RHEL distributions like Fedora, CentOS, and Rocky Linux. They simplify package management, installation, updates, and removal by handling all the package dependencies.

YUM is the older tool, and DNF is its modern successor, offering improved performance and features. Both package managers are essential for maintaining a stable and updated Linux system.

This article compares the two package managers, states their differences, and helps you choose the right one for your system.

DNF vs. YUM - learn the differences.DNF vs. YUM - learn the differences.

YUM Overview

‌YUM (YellowDog Updater Modified) was developed in 2003 to manage RPM packages on RHEL-based Linux distributions. The tool also facilitates the management of software repositories, allowing users to choose from a wide range of apps.

The tool simplifies package management by automatically resolving dependencies when installing, updating, or removing packages. That means that YUM installs all the necessary components for a software package or removes them when uninstalling.

Over the years, YUM became more capable, but it started facing some scalability issues, which made it slower. This limitation of YUM was what drove the development of DNF.

DNF Overview

DNF (Dandified YUM) was introduced in 2013 with the Fedora 18 Linux distribution and advertised as the next-generation package management utility. Essentially, DNF is an updated version of YUM with the same purpose – to simplify package management processes.

Compared to YUM, DNF has brought more functionality, better performance, improved dependency resolution, and better architecture while retaining compatibility with YUM. The main difference between them is that DNF adheres to a strict API, encouraging the development of various extensions and plugins.

Thus, all users familiar with YUM can smoothly transition to using DNF. All the commands are the same, requiring the users only to replace yum with dnf when running commands. DNF is the default package manager in Fedora 22, CentOS 8, and Rocky Linux.

YUM vs. DNF: What Are the Differences?

Both YUM and DNF are crucial package management tools in Red Hat Linux distributions. Understanding the differences between these two systems is critical to grasping their distinct functionalities, performance attributes, and approaches to dependency resolution.

The table below shows the key differences between the two utilities across various aspects:

Category YUM DNF
Initial Release In 2003. In 2013.
Languages Used for Development Python, with over 56k lines of code. C/C++ and Python, with over 29k lines of code.
Dependency Resolution Utilizes public APIs to resolve dependencies. Uses hawkey, a package management library built on top of libsolv, a package dependency solver.
Performance Slower performance compared to DNF. Faster performance than YUM – DNF utilizes libsolv to perform operations faster and with less memory consumption than YUM.
API YUM Python API, but poorly documented. DNF Python API. It is properly documented, allowing for faster development.
Plugin Support Many plugins are available to extend YUM’s functionality, such as enabling faster package downloads or adding support for different repository types.
Only Python-based extensions are supported.
DNF has extensive plugin support, but they are more tightly integrated with the tool’s core functionality and designed to be more lightweight and efficient.
Automatic Bug Reporting No. Yes.
User Cache No. Yes.

Read the sections below to delve deeper into the differences between the two package management tools.

Initial Release

YUM

Released in 2003 as the default package manager for Red Hat-based systems like RHEL and CentOS.

DNF

Introduced in 2013 as the next-generation package manager, aiming to replace YUM in newer versions of CentOS and RHEL.

Development Languages for YUM and DNF

YUM

YUM was developed using the Python programming language. It includes a small set of programs that provide a command-line interface, while the YUM Extender (yumex) is a graphical frontend tool for the package manager, also written in Python.

Python allows for easier extensibility but can impact performance in certain scenarios.

DNF

DNF was originally written in Python. However, in 2016, the developers made efforts to port it to the C programming language and move most of the functionalities from Python code into the new libdnf library. In 2018, the team announced they would move the libdnf library from C to C++.

With a combination of C/C++ and Python, DNF aims for better performance and efficiency in package management operations.

YUM vs. DNF: Performance

YUM

Compared to DNF, YUM is slower, which is noticeable during large package operations or complex dependency resolutions. The reason is that YUM uses a lot of memory, and its code is old.

There are also long-standing issues with YUM that hinder its performance. The issues remain because it would require rewriting much of its 56000 lines of code, which is why DNF came as a replacement.

The following screenshot is an example of using the YUM package manager to update the system repository:

An example of using the YUM package manager to update the system repository.An example of using the YUM package manager to update the system repository.

DNF

DNF offers better performance than YUM primarily because it utilizes a proven code base libsolv and a sophisticated dependency resolver tool. This tool allows DNF to perform operations faster and use less memory than YUM. Additionally, DNF has better support for parallel operations and can use delta RPMs for more efficient updates.

The following image is an example of using the DNF package manager:

An example of using the DNF package manager to update the system repository.An example of using the DNF package manager to update the system repository.

YUM vs. DNF: Dependency Resolution

YUM

YUM uses public APIs for dependency resolution. The dependency resolution process is slower and more resource-intensive in YUM than in DNF. It is slow because YUM computes the dependencies for each package individually and then recomputes them again for every installation, removal, or update.

The process is the same even if the dependencies have not changed. Consequently, YUM performs the exact computation multiple times, which is a waste of resources.

DNF

DNF uses hawkey, a package management library that builds on top of libsolv. It provides a more efficient dependency resolution by utilizing modern solving algorithms and creating a persistent metadata cache. That way, DNF reduces unnecessary computations by checking and storing the state of dependencies in the cache.

Through this approach, DNF can resolve dependencies faster because it only computes what is necessary and recalls the rest from the cache. Additionally, DNF’s dependency resolution process can resolve complex chains of dependencies while avoiding potential conflicts.

YUM vs. DNF: API

YUM

Having a Python-based API, YUM allows developers to access and manipulate the package manager’s functionalities using Python scripts or applications. The API allows the tool to install, remove, and update packages, manage repositories, query package information, and handle dependencies.

However, the API is poorly documented, making it difficult for developers to create new features. It is also relatively limited in its extensibility and lacks some of the advanced functionalities required for more complex package management operations.

DNF

DNF has significantly improved upon the limitations of the YUM API. It provides a more extensive and robust Python-based API that offers better flexibility, advanced functionalities, and more comprehensive capabilities for managing packages and repositories.

DNF has proper API documentation that allows developers to create extensions and plugins faster and makes it easy to implement new features.

What Are Advantages of DNF over YUM?

Although end-users might not notice it, DNF offers multiple advantages over its predecessor. Being YUM’s upgraded version, DNF has a lot of functionalities under the hood that make it a better choice in RHEL-based distributions.

The following list contains the key advantages that position DNF as a more efficient, versatile, and robust package manager:

  • Better Performance. DNF is faster and more efficient in package operations and dependency resolution, making package management tasks more responsive.
  • libsolv Integration. DNF leverages libsolv, a powerful library for solving dependencies. It enables a more accurate and reliable resolution of complex dependency chains while reducing potential conflicts.
  • Advanced API Support. The DNF Python API offers developers an extensive and flexible set of tools. This allows sophisticated interactions and enables the creation of complex package management tools and applications.
  • Broader Plugin Support. DNF has a more extensive plugin architecture, and its well-documented API allows for greater extensibility and customization.
  • Improved Error Handling. DNF features enhanced error reporting and handling mechanisms. It provides clearer and more informative messages during package management operations. The feature helps with troubleshooting and debugging.
  • Modern Architecture. DNF boasts a more modern architecture, combining C/C++ and Python, with enhanced performance, scalability, and maintainability over YUM’s Python-based design.
  • Compatibility. Since DNF is the successor to YUM in newer RHEL-based distributions, it enjoys wider compatibility and adoption. This leads to broader community support and a more active ecosystem.

Conclusion

This article has explained the differences between YUM and DNF, two package managers used in RHEL-based Linux distributions. DNF is the more modern version of YUM, which offers better performance and functionality and uses fewer system resources than YUM.

To learn more about Linux package managers, read our articles about the differences between RPM and YUM or see how YUM differs from APT, a Debian package manager.

Đăng ký liền tay Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !

Add Comment

Click here to post a comment

Đăng ký liền tay
Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !