Everything you need to know about the DNF package manager

Dandified Yum (DNF) is a powerful package management front-end for RPM-based Linux distributions.

 The following article will show you everything you need to know about the DNF package manager and the different DNF commands you can use to manage your packages.

Why use DNF package manager?

Many Linux distributions, such as Red Hat Enterprise Linux, CentOS Stream, and Fedora Linux have their own repositories that use RPM Package Manager (RPM) files to distribute programs, documentation, and libraries. It is a compressed archive format that can run scripts, verify the contents inside, and store package metadata.

One disadvantage of RPM is that it cannot install a package unless its prerequisites are present in the system. DNF bridges this gap by fetching the necessary dependencies for the package and resolving any software conflicts during installation.

Picture 1 of Everything you need to know about the DNF package manager

In addition, DNF also provides additional tools to install and manage packages in the system. It includes the ability to add external repositories, search for remote content, as well as support proper system recovery and cleanup.

Install the package using DNF

Installing packages is a basic function of every package manager. To install a remote package in DNF, run dnf install followed by the package name:

sudo dnf install nano

Picture 2 of Everything you need to know about the DNF package manager

The install command has a number of flags that allow changing its default behavior. For example, --setopt=install_weak_deps=False can be included to ignore 'Weak Dependencies' when installing a program.

Picture 3 of Everything you need to know about the DNF package manager

Fetch and install RPM files using DNF

DNF can also fetch empty .rpm packages from upstream repositories. This can be useful if you are setting up an offline machine and want to sideload RPM packages to that machine.

sudo dnf download emacs

You can even use the install command on the .rpm file to install it on your device. Doing this will provide the benefit of dependency resolution for non-repo packages.

sudo dnf install ~/your-package.rpm

Picture 4 of Everything you need to know about the DNF package manager

Reinstall existing packages

Furthermore, DNF may force reinstallation of programs in the current machine. This can be useful if you're having problems with an existing package and want to make sure you installed it correctly.

sudo dnf reinstall nano

Picture 5 of Everything you need to know about the DNF package manager

The reinstall command also has a number of optional flags to modify its behavior. For example, the --allowerasing flag will remove any potential dependency conflicts immediately upon reinstalling the program.

Process packet groups in DNF

Package grouping is a special DNF feature for installing programs around a theme or tool. This can be useful if you want to set up a consistent desktop build or manage a software collection.

To view the package groups available to the system, run the following command:

dnf group list

Picture 6 of Everything you need to know about the DNF package manager

The contents of a package group can be examined by running the info argument after the group command. For example, running dnf groups info Editors will print a short description of the group and the packages it will install.

Picture 7 of Everything you need to know about the DNF package manager

Install and remove package groups

The group command also handles its own installation process. Run the group command with the install argument , then provide the group name you want for your system:

sudo dnf group install Editors

Picture 8 of Everything you need to know about the DNF package manager

To remove an entire package group, replace the install argument with remove followed by the name of the group you want to remove:

sudo dnf group remove Editors

Picture 9 of Everything you need to know about the DNF package manager

Update 24 May 2024
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile