DNF and its APT command equivalents on Fedora (2024)

Michal Ambroz, Christopher Engelhard, The Fedora Docs teamVersion F37Last review: 2023-02-03

APT is the package manager/dependency solver for the Debian ecosystem, i.e. it manages .deb packages installed by the DPKG program. Fedora software is based on .rpm packages, and thus uses DNF, the package manager/dependency solver for the RPM program, instead. This document gives a brief overview of the most common APT commands one might find in tutorials and their DNF equivalents.

APT vs. DNF commands

Table 1. Apt vs DNF commands
APT commandDNF commandnotes

apt install

apt-get install

dnf install

Of course, actual package names may vary. For example, libc6-dev on Debian maps to glibc-devel in the Fedora universe.

apt install --only-upgrade package

dnf update package

Updates only already installed package and its dependencies. The apt install works for both install and upgrade single package if already installed.

apt update

apt-get update

dnf check-update

This command is rarely needed, as dnf updates its package cache automatically when it is stale. A cache update can be forced by appending --refresh to other commands, e.g. dnf upgrade --refresh.

apt upgrade

apt-get upgrade

dnf upgrade

Note that while apt update does something different, dnf update and dnf upgrade are synonyms. You can also use the shorter dnf up.

apt full-upgrade

apt-get dist-upgrade

dnf distro-sync or

dnf system-upgrade (see note)

While distro-sync is the most direct functional equivalent, dnf system-upgrade should be used to upgrade from one release to another, e.g. from Fedora Linux 34 to 35. This is a multi-step process as described here.

apt remove

apt-get remove

dnf remove

apt purge

apt-get purge

---

Fedora packages don’t treat configuration files in the same way as Debian packages, so there is no direct equivalent.

apt autoremove

apt-get autoremove

dnf autoremove

Note that this can occasionally remove packages that you might actually want. Use dnf mark to flag packages to keep.

apt search

apt-cache search

dnf search

dnf repoquery is useful for advanced searches.

With the exceptions of the distribution upgrade working differently, and DNF updating the cache automatically, the commands are very similar. More info on DNF can be found here.

Why is APT in the Fedora repositories?

APT can not be used to install packages on Fedora, you have to use DNF instead.

The apt command on Fedora used to — until Fedora 32 — actually be APT-RPM, which basically mapped normal apt commands so that they worked with Fedora’s RPM package management system.

However, APT-RPM is unmaintained, broken, and insecure, and so was dropped in favour of shipping the actual Debian APT software. Since APT exclusively deals with .deb packages, the apt command can no longer be used to manage Fedora packages. Its purpose is now purely as a tool for people building packages for Debian-based distributions on a Fedora system.

As an enthusiast deeply immersed in the world of package management systems and Linux distributions, I bring forth a wealth of knowledge and hands-on experience. My expertise spans various package management tools, including APT for Debian-based systems and DNF for Fedora. I've navigated the intricacies of these systems, exploring their commands, nuances, and the underlying mechanisms that govern them.

The article by Michal Ambroz, Christopher Engelhard, and the Fedora Docs team delves into the APT and DNF commands, providing a valuable resource for users transitioning between Debian and Fedora ecosystems. Let's break down the concepts presented in the article:

  1. APT (Advanced Package Tool):

    • Overview: APT is the package manager and dependency solver for the Debian ecosystem.
    • Operation: Manages .deb packages installed by the DPKG program.
    • Commands:
      • apt install: Installs packages (equivalent to apt-get install).
      • apt install --only-upgrade package: Updates only an already installed package and its dependencies.
      • apt update: Updates package lists.
      • apt upgrade: Upgrades installed packages.
      • apt full-upgrade: Upgrades packages, handling dependencies intelligently.
      • apt remove: Removes packages.
      • apt purge: Removes packages along with their configuration files.
      • apt autoremove: Removes automatically installed packages that are no longer required.
      • apt search: Searches for packages.
  2. DNF (Dandified Yum):

    • Overview: DNF is the package manager and dependency solver for the RPM program, used by Fedora.
    • Operation: Manages .rpm packages.
    • Commands:
      • dnf install: Installs packages (equivalent to apt install).
      • dnf update: Updates package lists (similar to apt update).
      • dnf upgrade or dnf up: Upgrades installed packages.
      • dnf distro-sync or dnf system-upgrade: Upgrades from one release to another.
      • dnf remove: Removes packages.
      • dnf autoremove: Removes automatically installed packages.
      • dnf search: Searches for packages.
  3. Key Differences and Notes:

    • APT and DNF commands have functional equivalents, with some variations in syntax.
    • Package names may differ between Debian and Fedora systems.
    • Fedora uses DNF to update its package cache automatically (dnf check-update is rarely needed).
    • The article emphasizes the shift from APT-RPM to Debian APT on Fedora for package management.

In conclusion, this article not only provides a comprehensive APT vs. DNF command comparison but also sheds light on the historical context of APT in Fedora repositories, clarifying its current role as a tool for building Debian-based distribution packages on Fedora systems. The detailed insights offered by the authors contribute to a deeper understanding of package management systems in the Linux landscape.

DNF and its APT command equivalents on Fedora (2024)
Top Articles
Latest Posts
Article information

Author: Horacio Brakus JD

Last Updated:

Views: 5535

Rating: 4 / 5 (51 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Horacio Brakus JD

Birthday: 1999-08-21

Address: Apt. 524 43384 Minnie Prairie, South Edda, MA 62804

Phone: +5931039998219

Job: Sales Strategist

Hobby: Sculling, Kitesurfing, Orienteering, Painting, Computer programming, Creative writing, Scuba diving

Introduction: My name is Horacio Brakus JD, I am a lively, splendid, jolly, vivacious, vast, cheerful, agreeable person who loves writing and wants to share my knowledge and understanding with you.