DNF and its APT command equivalents on Fedora
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 therefore 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 compared to 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 do not 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 |
|
|
|
DNF 和 APT 的命令结构大致相同,除了完全更新(distribution upgrade)机制不同,且 DNF 自动更新仓库状态缓存(即不区分 update 和 upgrade 环节)。关于 DNF 的更多信息,请参考相关文档。
Why is APT in the Fedora repositories
| Fedora 上*不能*用 APT 安装软件,必须使用 DNF。 |
The apt command on Fedora used to — until Fedora 32 — actually be APT-RPM, which mapped normal apt commands so that they worked with Fedora’s RPM package management system.
但 APT-RPM 已经不再维护,且存在已知功能和安全问题,因此 Fedora 已改为直接提供 Debian 版的 APT 软件。APT 只支持 .deb 软件包,因此 apt 命令无法用于管理 Fedora 上安装的软件。Fedora 提供的 APT 工具仅用于在 Fedora 系统上进行 Debian 或下游发行版软件的打包。
Want to help? Learn how to contribute to Fedora Docs ›