What is the difference between dnf and yum in centos8

yum and DNF are essentially programs that manage dependencies and software repositories, and then utilize RPM to actually install, download, and remove packages. DNF is the successor to yum, and its main difference from yum is that it uses some libraries from openSUSE's ZYpp package manager in an attempt to increase speed and improve other aspects


Let's first understand the RPM package
RPM is a package format and a low-level package manager. Low-level package managers do the basics, they will install packages for you, but they will uninstall a package you specify to be installed only if all its dependencies are already installed. They do not manage dependencies and repositories for you. RPM, like other low-level package managers like Debian's dpkg and Slackware's pkgtools, does not require the presence of a repository. So if you try to install a package with it but a dependency is missing, it will not automatically resolve it and require you to download and install it manually. You have to search for the RPM dependency package yourself and then specify the download URL to the RPM.
DNF first appeared
If you're a fan of Fedora and you upgraded to version 22, you may have noticed a major change. The familiar (and long-standing)The package manager is gone. In its place is the much more powerful and smarter Dandified Yum (DNF).
Why did we launch DNF package manager to replace yum? And how to use the new package management system?
Before we get started, understand that those who never touch the command line (which is probably rare on a Fedora system) shouldn't see anything unusual. The GUI front end remains (almost) the same - it's still the same desktop. However, if you're a fan of installing software from the command line, you'll notice a quick flash of new text when you issue a command.
Reasons why yum was eliminated
There are three main reasons why Yum was upgraded to DNF. These reasons are old and serious enough that Yum had to be abandoned:
An undocumented API - This meant more work for developers. In order for developers to be able to do what they needed to do, they often had to browse through the Yum codebase to write the calls. This meant that development was very slow.
Python 3 – Fedora is moving to Python 3 and Yum will not survive this change, whereas DNF can run with either Python 2 or Python 3.
Broken dependency resolution algorithm - This has long been the Achilles' heel of the Fedora package manager. DNF uses a state-of-the-art satisfiability (SAT) based dependency resolution. This is the same type of dependency resolver used in SUSE and openSUSE's Zypper.
Simply put, Yum is outdated and cannot stand up to the rigors of a modern Fedora distribution.
What are the advantages of dnf?
You have to look at this from two different perspectives: end user and developer. If you are an end user, switching from Yum to DNF means one very simple thing: a more reliable experience. The source of this reliability is DNF's superior dependency resolution. It is now very rare that the system cannot resolve a dependency when installing a package. The system is smarter. Yum's dependency algorithm was broken anyway. DNF's SAT-based dependency resolver solves this problem.
End users will also see less memory usage when installing packages. Installations and upgrades will also be faster. The last point should be especially important. Running upgrades using the Yum tool starts to become unacceptably slow (especially compared to tools like apt-get and zypper).
If you are a developer, moving to DNF means you will be able to work more efficiently and reliably. All exposed APIs are documented. Another advantage for developers is that the C language will be implemented. Developers have already created hawkeye and librepo (C and Python libraries for downloading packages and metadata from software repositories). They will also release more C-based APIs in the future. Considering that C is still a widely used language (currently ranked second in the TIOBE index), this should be a welcome change for developers.
How to use the dnf command?
This is where the good news for end users comes in. Migrating from Yum to DNF will only challenge your memory. When you open a terminal window to run a command-line installation, you tend to issue the command yum install php. But now it is no longer the case. The dandified command for the same will be dnf install php.
Switching from yum to dnf
There will be some bumps in the road. Yes, DNF is a replacement for Yum; if you are not an advanced user of Yum, you probably won’t run into any issues during the migration. However, there are still some issues to be discovered. Let’s examine the old yum update --skip-broken command. When this command is used, the update will be run but all packages with broken dependencies will be skipped. DNF, on the other hand, skips these broken packages by default. There is no need to include the “skip broken” flag to achieve this. If you need DNF to report broken packages, you must run DNF update and then DNF check-update. Some users don’t like this behavior because it adds extra steps to a once simple process. For advanced users, DNF may end up being more work than Yum. For standard users, on the other hand, DNF is nothing more than swapping out yum commands for DNF commands.
Migrating from Yum to DNF can be a little awkward for a while, especially when unsuspecting users open the command line and try to use yum. But even then, you get a warning:
Yum command has been deprecated, use dnf instead.
See 'man dnf' and 'man yum2dnf' for more information.
To transfer transaction metadata from yum to DNF, run 'dnf migrate'
Translated into Chinese, it probably means that the yum command has been deprecated, please use dnf
Clearly something has changed. However, I do think the developers could have been more explicit in their warnings, rather than just saying "man dnf". Instead, something closer to:
The yum command is no longer used. Please replace "yum" with "dnf" in your commands to use the new system.
Seeing such a prompt, all terminal users need to know is to replace "yum" with "dnf" and that's it.
yum and DNF are essentially programs that manage dependencies and software repositories, and then utilize RPM to actually install, download, and remove packages. DNF is the successor to yum, and its main differences from yum are that it uses some libraries from openSUSE's ZYpp package manager to try to increase speed and improve other aspects (although the installation speed tests I performed seemed to indicate that DNF actually has no significant advantage over yum).

score

Leave a Reply

Your email address will not be published. Required fields are marked *