Many Linux distributions (like Red Hat Enterprise Linux, CentOS and Fedora Core) use the Red Hat Package Manager (RPM) format to distribute program files, documentation and other application assets. It is like a compressed archive that can execute pre- and post-install scripts, plus it can specify different bits of metadata including a list of packages that need to be pre-installed. RPM packages won’t install unless all the pre-requisite packages have been installed. To solve these dependencies, Fedora, and other distributions, use the Yellowdog Updater (Modified) or “yum” to automatically perform dependency analysis and install the prerequisite packages, as well as any packages which they in turn rely on. yum can also automatically perform system updates, including the necessary dependency analysis, as well as uninstall packages. As a fork of yum, dnf is a repository manager, but it uses “libsolv” for dependency solving and the “hawkey” library to provide simplified C and Python APIs. To install “dnf” on Fedora (version 18 or later), run the following command, as root:
dnf works in a very similar way to yum (intentionally so). To install a package like “nano”, you would use (as root):
To search for a package, use the “search” sub-command:
To upgrade all the currently installed packages to the latest availbale version, use:
It is worth noting that in dnf, invoking “dnf update” is the same as the command “dnf upgrade“. This is slightly different to yum where “yum upgrade” was an alias for “yum –obsoletes update“. To remove a package from your system, use the “remove” sub-command in dnf: During the install and remove processes, some temporary files will be created. To make sure that these files are deleted once they are no longer needed, use the “clean” sub-command: The “clean all” command will get dnf to remove the cache files generated from the repository metadata, remove the local cookie files, remove any cache repository metadata, and any cached packages from the system. If you want to just remove one type of temporary file, rather than all of them, then use either “dbcache“, “expire-cache“, “metadata“, or “packages” instead of “all.” For example, to remove the cached packages from the system, use: If you need to know where a certain file came from, you can use the “provides” sub-command:
The output shows that the “less” binary found in “/usr/bin” comes from the corresponding “less” package. To find out more information about a package, dnf has a sub-command called “info” which displays a description and some summary information about the requested package. For example, to learn more about the “less” package, use:
Fedora 22 will likely be released some time during mid-2015. Until then, you can safely familiarize yourself with the dnf command. If you have trouble with any of the examples given above, please use the comments section below and we will see if we can help.