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
APT command | DNF command | notes |
---|---|---|
|
| Of course, actual package names may vary. For example, |
|
| Updates only already installed package and its dependencies. The |
|
| This command is rarely needed, as dnf updates its package cache automatically when it is stale. A cache update can be forced by appending |
|
| Note that while |
|
| While |
|
| |
| --- | Fedora packages don’t treat configuration files in the same way as Debian packages, so there is no direct equivalent. |
|
| Note that this can occasionally remove packages that you might actually want. Use |
|
|
|
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.
Want to help? Learn how to contribute to Fedora Docs ›
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:
-
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 toapt-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.
-
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 toapt install
).dnf update
: Updates package lists (similar toapt update
).dnf upgrade
ordnf up
: Upgrades installed packages.dnf distro-sync
ordnf system-upgrade
: Upgrades from one release to another.dnf remove
: Removes packages.dnf autoremove
: Removes automatically installed packages.dnf search
: Searches for packages.
-
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.