DNF is the new Package-Manager for RHEL-Based Systems. It replaces yum
and is the default since RHEL-8. The Syntax is more or less identical, so that the migration should be quite easy.
Install Package
[tux@server]$ dnf install <package-name>
Uninstall Packages
[tux@server]$ dnf remove <package-name>
Update all Packages
This command will show you all packages that have available updates. You can install them all at once.
[tux@server]$ dnf update
Check for Updates
This will only list installable updates without installing them.
[tux@server]$ dnf check-update
Check if Restart is Necessary
If you update core-libraries, you will need to restart your system for the changes to become effective. Otherwise the Kernel will still use the cached Version from the memory.
To check if you need a restart you can use this command.
[tux@server]$ needs-restarting
If this command is not available, it is included in the yum-utils
.
[tux@server]$ dnf install yum-utils
Search for Packages
If you don’t know the exact name you can use a search-term and see all packages that have a matching name or description.
[tux@server]$ dnf search <search-term>
Get Details
You can get more information like the version and description of a package with the info
parameter.
[tux@server]$ dnf info <package-name>
List installed Packages
This command will show all installed packages on your system.
[tux@server]$ dnf list installed
If you pipe it into a grep command, you can check whether a package is installed, without installing it, if it is not.
[tux@server]$ dnf list installed | grep htop
Package Groups
Most Repositories have predefined Package Groups. For Example a Desktop Environment with all it’s Utilities. That way all you can install everything you need as if it would be one package.
List Package Groups
[tux@server]$ dnf group list
Install Package Group
[tux@server]$ dnf group install "<group-name>"
Remove Package Group
[tux@server]$ dnf group remove "<group-name>"
Install local RPMs
You can also install rpm from your local disk, instead of a remote Package-Repository.
[tux@server]$ dnf install <package>.rpm