APT vs. DNF vs. YUM: Linux Package Managers Compared

Using the command line to add or remove programs on Linux isn’t necessary, but it is faster than using a graphical application. Many people find that at some point in their Linux journey, they end up opening a terminal to install new apps or system updates.

APT and DNF are two of the most popular package managers for the job. These two programs are very similar, but they do have some differences in how they function. Let’s dive in.

4

Getting to Know APT and DNF

APT and DNF have much in common and share similar syntax for many functions. If you are already familiar with either one, you probably won’t have a difficult time learning the other. If you’re a complete newcomer, know that these two package managers are among the easier ones to learn, especially compared to the less intuitivePacman package manager found in Arch Linuxand other Arch-based distros.

APT is short for Advanced Package Tool. It serves as the default package manager for Debian and, by extension,Debian-based Linux distributionslike Ubuntu. Since Ubuntu is the most popular Linux distro, and there are scores of distros based on Ubuntu, APT is the package manager many of us encounter first. Software in Linux comes in different formats, and APT works with the DEB package format in particular.

MacBook and a Dell laptop running ZorinOS next to each other

DNF is the default package manager in Fedora and Fedora-based distros such as Red Hat Enterprise Linux and CentOS. DNF works with the RPM package format.

DNF vs. YUM

DNF’s name isn’t an acronym. Those three letters are short for “Dandified YUM.”

DNF is a rewrite of YUM, the “Yellowdog Updater, Modified.” YUM itself was already a rewrite of “Yellowdog UPdater,” or YUP, originally developed for Yellow Dog Linux.

firefox logo with yellow warning symbol

While you may see YUM in use on older systems, it has been discontinued in favor of DNF. There isn’t much reason to seek out YUM today.

Example APT and DNF Commands

Let’s start with one of the first tasks many of us perform after installing a new Linux distro—downloading system updates.

Download System Updates

In APT, this consists of two commands.

Let’s break these down.

Dell monitor showing Windows 10 desktop

sudogives you administrative access to your system. Without it, your command will fail with an error message due to a lack of permission.

Theupdatecommand downloads metadata about the packages from your available software sources so that your computer knows what versions to request.

DNF-Upgrade-GNOME-Terminal-Icon-Featured

Once your local database is up-to-date, then it’s time to download and install the latest software. That’s where theupgradecommand comes in.

To install system updates using DNF, run:

DNF checks for metadata automatically whenever you begin a system update or otherwise install software. For this reason, theupdateandupgradecommands perform the same function, and you are free to use them interchangeably.

Search for a Package

Let’s say you want to install a program, but you don’t know the exact name your distro uses for the package the program comes in. In a graphical app, you can browse through available software, but in the command line, you must perform a text-based search instead.

In this case, whether you’re using APT or DNF, you only need to remember a single command, and it’s one you could probably guess. If you want to search for a program with the name “package,” simply type:

Install Software

Like with performing a search, the command to install a program using APT or DNF is the same.

One advantage DNF has over APT is the ability to install RPMs that you’ve downloaded manually from the web. You can do so using the sameinstallcommand, but include the full path to the RPM instead of a package name.

In contrast, to install a DEB that you’ve put in your Downloads folder, you cannot use APT and must turn to a separate command-line programsuch as dpkg.

Uninstall Software

There are several ways to make software go away using APT. The first and most direct option is:

To remove configuration files, in addition to app data, run:

To have APT automatically remove software that was installed as a dependency and is no longer needed, you may use:

DNF doesn’t have a direct equivalent to thepurgecommand, sinceRPM-based distrosdon’t manage configuration files in the same way as Debian-based systems. But the other two options are the same.

To uninstall a program using DNF, run:

And to automatically remove unneeded dependencies, use:

DNF and APT Are More Alike Than Different

Some long-time Linux users have an established preference between APT and DNF. They’ve learned the syntax to do more powerful operations, and switching involves relearning what they already know.

But for newcomers, these two package managers are largely the same. Their differences are subtle, such as DNF automatically downloading package information before installing software or checking for updates.

The two package managers also present information differently, as you can see in the two screenshots above.

Yet both are command-line programs that operate near instantaneously, with wait times having more to do with your internet connection and the speed of the servers you’re connecting to. For most of us, gaining access to a different package manager is hardly a reason to switch from one Linux distro to another.

APT vs. DNF: Which Should You Use?

Whether you use APT or DNF largely depends on which distro you use. This means, for most Linux users, the choice is made for us. But if you do have a strong enough preference, you can choose your distro based on whether it uses APT or DNF.

Neither package manager is particularly more powerful or more capable than the other. So whichever one you’re stuck with is a perfectly fine one to learn. And if you do need to switch someday, doing so isn’t all that difficult.

Do you keep switching Linux distros in search of the best? Here’s how to find a suitable distro for yourself, one you can stick with for decades.

It’s not super flashy, but it can help to keep your computer up and running.

Goodbye sending links via other apps.

You’ve been quoting these famous films wrong all along!

Who asked for these upgrades?

Tor spoiled me forever.

Technology Explained

PC & Mobile