Most people treat dnf as a drop-in replacement for yum and stop there.

But that misses a lot of what makes DNF worth learning; automatic dependency resolution, transaction history with full undo support, module streams, and a plugin system that goes beyond what yum offered.

DNF (Dandified YUM) has been the default package manager on Fedora since Fedora 22 (2015) and on RHEL since RHEL 8 (2019).

It is used across RHEL 8/9/10, Rocky Linux, AlmaLinux, CentOS Stream, and Fedora.

If you’re still typing yum on any of these systems, it is usually linked or aliased to DNF anyway.

One important distinction for 2025/2026 is DNF5.

DNF5 is a complete C++ rewrite of DNF and is now the default package manager on Fedora 41 and later, including Fedora 44, the current release.

On Fedora 41+, /usr/bin/dnf is a symlink to /usr/bin/dnf5 for backward compatibility, so the commands in this article still work.

However, if you’re using Fedora 41 or later, writing dnf5 explicitly is recommended.

On the enterprise side, RHEL 9, Rocky Linux 9, AlmaLinux 9, and RHEL 10 still use DNF (dnf4) as the default package manager.

DNF5 has not yet replaced DNF on these systems.

All examples below are tested on RHEL 9, Rocky Linux 9, and Fedora 44.

A dedicated DNF5 section at the end of this article covers what changes on Fedora 41+.

Prerequisites: You need a working RHEL 8/9/10, Rocky Linux, AlmaLinux, or Fedora system.

Most commands require sudo or root privileges; commands that don’t are noted accordingly.

You might also like:

DNF automatically resolves and installs all required dependencies.

You can also install multiple packages with a single command:

To skip the confirmation prompt, use -y.

This is especially useful in scripts:

This removes the package but does not automatically remove all of its dependencies.

If you also want to remove packages that were installed as dependencies and are no longer required, use autoremove instead (see Example 8).

In DNF, update and upgrade are equivalent.

Both update packages and handle obsolete packages, so there is no practical difference between the two commands.

This updates all installed packages to the latest versions available from your enabled repositories.

Before making any changes, you can check whether updates are available:

check-update returns exit code 100 when updates are available and 0 when the system is up to date.

This makes it useful in scripts and cron jobs.

To search both package names and package descriptions, use:

The results include the package name, architecture, and a short summary.

You don’t need sudo for package searches.

This displays details such as the version, release, architecture, installed size, source repository, summary, and description without installing the package.

To view information about a package that is already installed:

To check whether a specific package is installed, filter the output with grep command:

To list packages available from your enabled repositories, whether installed or not:

As you install and remove packages over time, some dependencies may no longer be needed.

DNF can identify and remove these orphaned packages with autoremove:

Run it periodically to keep your system clean.

DNF only removes packages that were installed as dependencies and are no longer required by any installed package.

DNF stores package metadata and downloaded RPMs in /var/cache/dnf.

You can clean the cache if a repository is returning stale data or you’re running low on disk space:

To clean only the metadata while keeping downloaded packages:

After cleaning the metadata, the next dnf command downloads fresh metadata from all enabled repositories.

DNF keeps a transaction history of package installations, updates, and removals.

To view recent transactions:

You may see output like this:

Each transaction has a unique ID that you can use to inspect what happened.

For example:

This shows the packages affected by transaction 12, along with additional transaction details.

One of DNF’s most useful features is the ability to undo a previous transaction using its ID.

For example:

DNF attempts to reverse transaction 12.

If the transaction installed three packages, those packages are removed.

If it upgraded packages, DNF attempts to restore their previous versions.

You can also redo a transaction that was previously undone:

If a newer package version causes problems, you can downgrade it to an older available version:

DNF selects the highest available version that is older than the currently installed version.

To install a specific version instead, specify the complete package version:

If you’ve downloaded an RPM file manually, you can install it by passing its path directly to dnf install.

Unlike rpm -i, DNF can resolve and install missing dependencies from your configured repositories:

To list all enabled repositories and their status:

To see both enabled and disabled repositories:

You can enable or disable a repository for a single command using –enablerepo and –disablerepo:

To permanently enable or disable a repository:

To add a repository using its URL:

Repository configuration files are stored in /etc/yum.repos.d/.

After adding a repository, verify that it appears in the repository list:

DNF supports package groups, which are collections of related packages that can be installed together.

To see the available groups:

To install a group:

To remove a group:

Note: Module streams apply to RHEL 8/9, Rocky Linux, and AlmaLinux.

Fedora retired modularity in Fedora 39, so on Fedora 40 and later, you install specific package versions directly from the repositories or use third-party repositories instead.

On RHEL 9 and Rocky Linux 9, DNF modules allow you to work with different versions of a package; for example, Node.js 18 or Node.js 20 without adding third-party repositories:

To switch to a different stream:

On RHEL 10, module streams continue to be supported with an updated set of available streams.

Run dnf module list on your system to see the current catalog.

When a command is missing, and you need to find out which package provides it, use dnf provides:

For example, the output may look like this:

This tells you that the net-tools package provides /usr/bin/netstat.

If a package’s files are corrupted or accidentally deleted, you can reinstall the package without changing its version:

DNF downloads and reinstalls the same version that is currently recorded as installed.

To check for broken dependencies across installed packages:

To verify the integrity of a specific package’s installed files against the RPM database, use:

If everything is intact, the command produces no output.

If you see any lines, they indicate files that differ from the original package.

This can help identify accidental changes or corrupted files.

DNF5 is a ground-up rewrite of DNF in C++.

It removes the Python dependency, processes metadata faster, uses less memory, and provides a cleaner, more consistent command-line interface.

DNF5 became the default package manager in Fedora 41, released in October 2024, and remains the default in later releases, including Fedora 44.

On Fedora 41 and later, /usr/bin/dnf points to /usr/bin/dnf5, so the commands in this article continue to work as expected.

However, using dnf5 explicitly is recommended going forward.

Most commands are the same in DNF and DNF5.

Here are the differences worth knowing.

With DNF5, upgrade is the preferred command for updating packages.

update is still available as an alias, but upgrade is the canonical command.

Repository Management – Slightly Different Flags

DNF5 includes config-manager as a built-in subcommand, so you don’t need a separate plugin for it.

To add a repository:

To enable or disable a repository:

To remove cached metadata and packages:

DNF5 uses check-upgrade as the preferred command instead of check-update.

The older check-update command is still available as an alias.

Module streams have only basic support in DNF5 on Fedora.

Fedora retired modularity in Fedora 39, so this is generally not relevant to current Fedora releases.

On RHEL and Rocky Linux, DNF4 remains the default and provides full module stream support.

DNF5 is not yet the default on RHEL 9, RHEL 10, Rocky Linux, or AlmaLinux, so use the standard dnf commands on those systems.

DNF is much more than a replacement for yum.

It gives you better dependency resolution, transaction history, package rollback, repository management, package groups, and tools for finding and troubleshooting packages.

For RHEL, Rocky Linux, AlmaLinux, and CentOS Stream, getting comfortable with dnf is an essential part of managing modern RPM-based systems.

If you’re using Fedora 41 or later, you’ll also want to become familiar with DNF5 and its updated commands.

Once you know these commands, everyday package management becomes simpler, safer, and easier to troubleshoot whether you’re installing a single package or maintaining a production Linux server.

What’s the first DNF task you’d trust yourself to automate on a production server, and what’s the one you’d always run manually? Drop it in the comments the commands are simple, but knowing where to draw the line matters.

usermod Command: Manage Linux Users, Groups, UID, Shell and More

8 chattr Commands to Make Files Immutable and Prevent Changes in Linux

12 Ways to Use the dmesg Command in Linux to View and Troubleshoot Kernel Messages

View and Manage Files using head, tail and cat Commands in Linux

16 Fun Linux One-Liners Every Command-Line User Should Try

How to Use the watch Command in Linux to Monitor Commands in Real Time

DNF stands for Doesn’t Fing work, which is pretty accurate.

Use yum instead.

Um, DNF is Yum…DNF stands for DaNdiFied yum.

https://en.wikipedia.org/wiki/DNF_(software)
http://dnf.baseurl.org/2017/08/02/the-first-dnf-update-for-fedora-26/

The article is wrong DNF does stand for something.

Distribution Neutral File manager

I have installed DNF in RHEL 7.

While i try to update dnf, i got the below error.
# dnf update
“Failed to open: /var/cache/dnf/x86_64/7.1/x86_64/7.1/epel/repodata/78892cbf09fce6504b691ad19bf59507d65da9eacdebc0aa6ed1d053b502f829-updateinfo.xml.bz2.”

@Ravichandran,

Try to run following series of commands to fix that error.

If you still see the same error, try to disable extra add-on repositories like EPEL or RepoForge, these repositories are for RHEL/CentOS Only.

First, check your /etc/yum.repos.d/ directory, here if you find other than fedora.repo, fedora-updates.repo, and fedora-updates-testing.repo.

Remove or disable them and then run the following command.

Hope, it will fix your problem..

i had alway find this problem but when i operated this what you told ,it doen’t work [duwenink@localhost ~]$ su
密码:
[root@localhost duwenink]# dnf clean all
清理软件仓库: rpmfusion-free rpmfusion-free-updates fedora epel updates
清理所有内容
[root@localhost duwenink]# dnf repolist
Extra Packages for Enterprise Linux 7 – x86_64 2.4 MB/s | 10 MB 00:04
Failed to open: /var/cache/dnf/epel-2b6dfc5904c26562/repodata/b0b669b11555557436c35421a026af14feafd01ee60059737cddbc39853c66eb-updateinfo.xml.bz2.
[root@localhost duwenink]# dnf upgrade
RPM Fusion for Fedora 23 – Free 1.6 MB/s | 738 kB 00:00
Failed to open: /var/cache/dnf/epel-2b6dfc5904c26562/repodata/b0b669b11555557436c35421a026af14feafd01ee60059737cddbc39853c66eb-updateinfo.xml.bz2.

@Duwenink,

Try to run the following commands to fix that error”

You may wish to work on your english a bit because this is full of errors making it difficult to read, but thanks for the article.

I would suggest to have some kind of patching solution integrated to this tool..

All the Best

Patch for DNF?

Oh its still infant.

It needs proper architecture and codes not patch as of now.

Maybe you could write about how DNF/Libsolv/Hawkey compares to APT-GET and what the benefits are to using one over the other…

Or possibly how the new Gnome 3 “Software” interacts with DNF.

May be!

But the theme of article was Yum replacement with DNF.

As far as software interaction matters, let the project attain some level of maturity.

Collectl: An Advanced All-in-One Performance Monitoring Tool for Linux

linux-dash: Monitors “Linux Server Performance” Remotely Using Web Browser

Installing “PHP Server Monitor” Tool using LEMP or LAMP Stack in Arch Linux

How to Monitor Docker Containers with Zabbix Monitoring Tool

btop: A Modern and Resourceful System Monitor

How to Do Security Auditing of Linux System Using Lynis Tool

4 Ways to Find Server Public IP Address in Linux Terminal

How to Use GNU bc (Basic Calculator) in Linux

tuptime – Tracks Your Linux System’s Past and Future Uptime

How to Restrict SFTP Users to Home Directories Using chroot Jail

Understanding Shared Libraries in Linux

4 Ways to Find Out Which Process Listening on a Particular Port

15 Best Tiling Window Managers for Linux in 2025

12 Best Command-Line FTP Clients for Linux Users

8 Best IRC Clients for Linux in 2024

5 Open Source Log Monitoring and Management Tools for Linux

10 Top Open Source Caching Tools for Linux in 2024

5 Google Docs Alternatives You Can Self-Host on Linux

—

**📚 Original Source:**
[20 DNF Commands Every Linux Administrator Should Know](https://www.tecmint.com/dnf-commands-linux/)

About The Author