dnf command on Linux (Installing and updating packages)
Linux distributions based on Red Hat use package manager called Red Hat Package Manager — RPM to install your software. Among the most famous distributions are Red Hat’s own Linux Enterprise, Fedora, and CentOS.
RPM is a powerful package manager that allows the administrator to install, remove, and obtain package information. It is a software distribution method widely used in several Linux distributions, in addition to Red Hat.
It also makes it possible to build packages from source files, verify the digital signature, simulate an installation of programs, among others. It’s as powerful as dpkg and apt-get.
The Linux distribution Fedora made its own package manager based on Red Hat, called DNF.
DNF is a software package manager that installs, updates, and removes packages in RPM-based Linux distributions, much like YUM.
It automatically calculates dependencies and determines the actions required to install packages.
DNF also makes it easy to maintain groups of machines, eliminating the need to manually update each one using rpm.
Introduced in Fedora 18, it has been the standard package manager since Fedora 22.
For many, DNF or “Dandified Yum” is the next generation version of Yum.
It maintains the compatibility of the Yum interface and defines a strict API for extensions and plugins. The fact that it allows the installation of plugins is very welcome, as they can modify or expand the features of the DNF and provide additional interface commands.
dnf installation
If DNF isn’t installed on your Red Hat-based distribution, you can do so using Yum:
The commands that DNF accepts are very similar to Yum:
- autoremove: removes a package and its dependencies (only if not used by other programs)
- check: Checks the RPM database and produces check-update information
- [package name]: Checks for package updates
- clean: Delete temporary files from the
- distro-sync repositories: Upgrade or downgrade packages to keep them the same as the latest version of the repository
- downgrade [package name]: downgrade a group package
- [info] [install] [list ] [remove] [upgrade]: Perform commands with software
- history groups: list the transactions performed
- info [package name]: shows information about a package install package_name
- : install a particular package and its dependencies
- list: list the installed and available packages
- provide [name]: list the packages containing the requested name
- remove package_name: remove a particular package repolist
- : list known repositories
- upgrade [package name]: upgrade one package or all if the package name is not specified
Examples of using DNF are very similar to YUM, since DNF is considered an evolution of YUM.
Conclusion
Whether you use Fedora or Red Hat, the dnf command is essential for managing packages in these distributions.