- Package management system
- Advantages of package management systems
- Disadvantages of package management systems
- Why mixing source installs and packages is a bad idea
- Preferred search order for a software
- Package Management tools
- Using the DNF software package manager
- Usage
- Automatic Updates
- System Upgrades
- Language Support Using DNF
- Plugins
- Excluding Packages From Transactions
- Using the DNF Versionlock plugin
- References
- APT command equivalents on Fedora with DNF
- APT vs. DNF commands
- Why is APT in the Fedora repositories?
Package management system
Fedora is a distribution that uses a package management system. This system is based on rpm , the RPM Package Manager, with several higher level tools built on top of it, most notably PackageKit (default gui) and DNF. GNOME Software is another GUI package manager.
Advantages of package management systems
Package management systems have many advantages:
- It’s easy to query what version of a package is installed or available.
- It’s easy to remove a package entirely, making sure all its files are gone.
- It’s easy to verify the integrity of the packages files, so you can see if it’s been corrupted or tampered with.
- It’s easy to upgrade a package by installing the new version and removing all the old versions files. This will make sure not to leave any lingering files from the old package around to confuse or break things.
- It’s easy to see what packages require or provide things that other packages provide or require, so you can be sure to have the needed items for the package to function correctly.
- It’s easy to install or remove groups of packages.
- In many cases it’s possible to downgrade back to a previous version of a package, for example when a new version has a bug.
Disadvantages of package management systems
- You are restricted to either using the versions of the package that are available or having to make your own package if you need a different version.
Why mixing source installs and packages is a bad idea
Package management systems have no way to query or note when you bypass them and install something from source. You should avoid mixing source installs and packaged installs for (at least) the following reasons:
- You lose all the advantages above from a package managed system.
- Installing from source may overwrite, delete, or change existing files that are in a package, making that package not function correctly.
- The source install may override a package install causing undefined behavior in the package or source installed item.
- Installing from source makes it impossible or very difficult for anyone to help you debug issues, since versions can’t be easily queried and integrity checked.
- Fedora packages may include patches or configuration to work with other packages, but upstream source does not, leading to loss of functionality.
- Software installed from source will not upgrade with package managed packages, leading to breakage in the source install package on upgrades or os updates.
Strongly consider making your own package if you need a different version or a version of some package with changes. See: Packaging Tutorial: GNU Hello
Preferred search order for a software
If some software is missing in your installation then you should try the following steps to get the packaged version:
- Search in Fedora ( ‘dnf search foo’ or search for ‘foo’ in the PackageKit gui )
- Try one of the available third-party repositories
- Build your own package
Package Management tools
Here are some tools for managing packages:
- dnf — Dandified Yum
- PackageKit — PackageKit gui tool (‘add/remove software’ in your menu)
- GNOME Software — Graphical package manager for GNOME
- KDE Discover — Graphical pacakge manager for KDE Plasma
- rpm — RPM package manager.
- yumex — Yum Extender. »’
See a typo, something missing or out of date, or anything else which can be improved? Edit this document at https://pagure.io/fedora-docs/quick-docs.
All Fedora Documentation content available under CC BY-SA 4.0 or, when specifically noted, under another accepted free and open content license.
Last build: 2023-07-13 04:50:22 UTC | Last content update: 2022-05-04
Using the DNF software package manager
DNF is a software package manager that installs, updates, and removes packages on Fedora and is the successor to YUM (Yellow-Dog Updater Modified). DNF makes it easy to maintain packages by automatically checking for dependencies and determines the actions required to install packages. This method eliminates the need to manually install or update the package, and its dependencies, using the rpm command. DNF is now the default software package management tool in Fedora.
Usage
dnf can be used exactly as yum to search, install or remove packages.
To search the repositories for a package type:
Other common DNF commands include:
- autoremove — removes packages installed as dependencies that are no longer required by currently installed programs.
- check-update — checks for updates, but does not download or install the packages.
- downgrade — reverts to the previous version of a package.
- info — provides basic information about the package including name, version, release, and description.
- reinstall — reinstalls the currently installed package.
- upgrade — checks the repositories for newer packages and updates them.
- exclude — exclude a package from the transaction.
For more DNF commands refer to the man pages by typing man dnf at the command-line, or DNF Read The Docs
Automatic Updates
The dnf-automatic package is a component that allows automatic download and installation of updates. It can automatically monitor and report, via e-mail, the availability of updates or send a log about downloaded packages and installed updates.
For more information, refer to the Read the Docs: DNF-Automatic page.
System Upgrades
The Fedora system can be upgraded directly with DNF, or with the DNF system upgrade plugin. Refer to the DNF System Upgrade document for more details.
Language Support Using DNF
DNF can be used to install or remove Language Support. A detailed description with a list of available languages can be found on Language Support Using Dnf page.
Plugins
The core DNF functionality can be extended with plugins. There are officially supported Core DNF plugins and also third-party Extras DNF Plugins. To install them, run
# dnf install dnf-plugins-core-PLUGIN_NAME
# dnf install dnf-plugins-extras-PLUGIN_NAME
Excluding Packages From Transactions
Sometimes it is useful to ignore specific packages from transactions, such as updates. One such case, for example, could be when an update includes a regression or a bug. DNF allows you to exclude a package from the transaction:
sudo dnf upgrade --exclude=packagename
You can add a line to /etc/dnf/dnf.conf to exclude packages:
This can also be added to the specific repository configuration files in /etc/yum.repos.d/ . Globs may be used here to list multiple packages, and each specification must be separated by a comma. If you have used this configuration, you can disable it in individual DNF commands using using the —disableexcludes command line switch.
If you use a GUI update application which does not allow you to specify packages to exclude when they run, this method can be used.
Using the DNF Versionlock plugin
You can also use the DNF versionlock plugin to limit the packages that are included in a transaction. It allows you to list what versions of particular packages should be considered in a transaction. All other versions of the specified packages will be ignored. The plugin is part of dnf-plugins-core package and can be installed using the command below:
sudo dnf install 'dnf-command(versionlock)'
To lock the currently installed version of a package, use:
sudo dnf versionlock add package
To remove the version lock, use:
sudo dnf versionlock delete package
The list command can be used to list all locked packages, while the clear command will delete all locked entries.
References
All Fedora Documentation content available under CC BY-SA 4.0 or, when specifically noted, under another accepted free and open content license.
Last build: 2023-07-13 04:50:22 UTC | Last content update: 2022-10-15
APT command equivalents on Fedora with DNF
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
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
Updates only already installed package and its dependencies. The apt install works for both install and upgrade single package if already installed.
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 .
Note that while apt update does something different, dnf update and dnf upgrade are synonyms. You can also use the shorter dnf up .
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.
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 dnf mark to flag packages to keep.
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.
All Fedora Documentation content available under CC BY-SA 4.0 or, when specifically noted, under another accepted free and open content license.
Last build: 2023-07-13 04:50:22 UTC | Last content update: 2023-02-08