DNF and YUM are both package managers for RPM-based Linux distributions, but DNF is the modern successor to YUM. The short answer: DNF is the default package manager on Fedora, RHEL 9, and their derivatives, while YUM is legacy and no longer actively developed. This article explains what each tool does, how they differ, and which one you should use.
Background: What Are DNF and YUM?
YUM (Yellowdog Updater Modified) was created in the early 2000s to automate package installation, updates, and removal on RPM-based systems. It solved the dependency resolution problem by using repositories—collections of packages with metadata that describe dependencies. YUM became the standard on Fedora, CentOS, and RHEL.
DNF (Dandified YUM) is a fork of YUM that was introduced in Fedora 18 (2013) and became the default in Fedora 22 (2015). It was written from scratch using modern libraries (libsolv, hawkey) to improve performance and fix architectural issues. DNF is now the default on Fedora, RHEL 8 and 9, CentOS Stream, and Rocky Linux.
How Each Tool Works
Both tools operate by reading repository metadata, resolving dependencies, and downloading/installing RPM packages. The key difference is the underlying engine:
- YUM uses the original Python-based dependency resolver, which can be slow with large repositories and sometimes fails to find optimal solutions.
- DNF uses libsolv, a C library that solves dependencies much faster and more accurately. It also has a cleaner API and supports features like transaction history and rollback.
Command syntax is nearly identical for common tasks. For example, yum install httpd and dnf install httpd both install the Apache web server. However, DNF has some additional commands like dnf history (view past transactions) and dnf system-upgrade (for major version upgrades).
Key Differences: Performance, Dependencies, and Features
Here are the most important differences you’ll notice in practice:
- Speed: DNF is noticeably faster at resolving dependencies because libsolv uses SAT (Boolean satisfiability) solving. On a large repository, DNF can be 2–3x faster than YUM.
- Dependency resolution: DNF’s solver is more robust and can find solutions that YUM misses. It also handles weak dependencies (recommends) better.
- Transaction history: DNF keeps a detailed log of every transaction, allowing you to undo or redo changes with
dnf history undo. - Python 2 vs Python 3: YUM was written for Python 2, which reached end-of-life in 2020. DNF supports Python 3, making it future-proof.
- Plugin system: DNF has a more modular plugin architecture, though YUM also supports plugins.
How to Choose Which to Use
Your choice is mostly determined by your distribution:
- Fedora, RHEL 8+, CentOS Stream, Rocky Linux, AlmaLinux: Use DNF. It’s the default and YUM is often just a symlink to DNF.
- RHEL/CentOS 7 or older: Use YUM. It’s the native package manager.
- Any modern RPM distro: If you type
yumand it runs DNF (you’ll see a notice), you’re fine either way.
If you’re writing scripts, check which command exists with which dnf or which yum. On systems where both exist, prefer DNF for new scripts.
Common Problems and Misconceptions
One common misconception is that YUM and DNF are completely different tools. In reality, DNF is a fork, so they share many concepts. Another is that YUM is “broken”—it isn’t, but it’s unmaintained and lacks modern features.
A frequent issue when migrating from YUM to DNF is that some third-party repositories may not have DNF-compatible metadata. However, most modern repos work with both. If you see an error like “Could not parse metalink,” it’s usually a network or repo configuration issue, not a DNF-specific bug.
Another problem: DNF’s history database can grow large. You can clean it with dnf history clear if needed.
Comparison: Command Equivalents
Here’s a quick reference for common tasks:
- Install:
yum install→dnf install - Update:
yum update→dnf upgrade(thoughdnf updatealso works) - Remove:
yum remove→dnf remove - Search:
yum search→dnf search - List installed:
yum list installed→dnf list installed - Check updates:
yum check-update→dnf check-update
Note that dnf update is an alias for dnf upgrade, so both work.
Safety and Maintenance Tips
When using either tool, follow these guidelines to avoid breaking your system:
- Always read the list of packages to be removed or updated before confirming.
- Use
--excludeto skip packages you don’t want updated (e.g., kernel). - Use
dnf history undoto roll back a problematic update (DNF only). - Never force remove packages with
--nodepsunless you know exactly what you’re doing. - Keep your system updated regularly to get security patches.
Alternatives to DNF and YUM
Other package managers exist for RPM systems, though they’re less common:
- zypper (openSUSE) – uses libzypp, similar to DNF.
- urpmi (Mandriva/Mageia) – older, with a different approach.
- apt-rpm – a port of Debian’s apt to RPM, now mostly obsolete.
For most users, DNF is the right choice. If you’re on an older system, YUM is fine, but consider migrating to a supported distribution.
Frequently Asked Questions
Is DNF faster than YUM?
Yes, DNF is generally faster, especially when resolving dependencies. The libsolv solver is more efficient than YUM’s Python-based resolver, so large transactions complete quicker.
Can I use DNF on CentOS 7?
Yes, you can install DNF on CentOS 7 via EPEL, but it’s not the default. However, CentOS 7 is end-of-life, so you should upgrade to a supported OS like Rocky Linux or AlmaLinux.
Will YUM still work on Fedora?
On Fedora, the yum command is a symlink to DNF, so it works but actually runs DNF. It’s better to use dnf directly to avoid confusion.
What is the difference between yum update and yum upgrade?
Traditionally, yum update updates packages but doesn’t remove obsolete ones, while yum upgrade also removes obsolete packages. In practice, on modern systems they behave identically, and DNF treats them as aliases.
How do I roll back a package update with DNF?
Use dnf history to list transactions, find the ID of the update you want to undo, then run dnf history undo ID. This reverts the packages to their previous versions.
Can I use YUM and DNF side by side?
Technically yes, but it’s not recommended because they share the same RPM database and could conflict. Stick to one tool to avoid inconsistent state.
Related
Formula used
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Philips DST7060/20 7000 Series Iron: Specs & Fit
- Coal Fueled Jet Aircraft: Could It Work?675 L
- Remote Desktop on Raspberry Pi: How to Enable It
- Word Select Last Line in Paragraph?
- Google Assistant IFTTT Recipes: 7 Useful Automations
- OLED TVs in Dark Rooms: Why They Look Better and When They Don’t