Everything You Need to Know About the DNF Package Manager
Dandified Yum (DNF) is a effective package overseeing front-run out for RPM-based Linux distros. Here we underscore you every little thing that you need to recognize about the DNF package supervisor and also the complex DNF commands you can consumption to oversaw your packages.
- Why Gain earn utility of of DNF Package Manager?
- Placing Packages utilising DNF
- Handling Package Teams in DNF
- Filtering system for Accessible Packages
- Bring Package Lists in DNF
- Overhauling System Packages
- Uninstalling System Packages utilising DNF
- Yawping Ago System Amendments in DNF
- Unravelling Current System Packages
- Handling Databases in DNF
Why Gain earn utility of of DNF Package Manager?
The majority of Linux distros, such as Red Hat Venture Linux, CentOS Stream, and also Fedora Linux have their own repositories that consumption RPM Package Manager (RPM) files to disseminate plans, documentation, and also hodgepodges. It’s a compressed archive style that can run manuscripts, confirm its inner content, and also storefront package metadata.
One disadvantage of RPM is that it can’t install a package unless its needs are in the tool. DNF footways this hole by fetching the obligatory dependences for your package and also squaring any software implementation confrontations throughout installation.

Withdrawn from that, DNF in addition lends secondary gizmos for placing and also overseeing packages in your tool. It entails the ability to have exterior repos, lookout for confidential content, as nicely as proportionate tool tidy-up and also rollback stabilize.
Diligent to recognize: learn added about other RPM-based Linux distros by peeking at AlmaLinux vs. Rocky Linux.
Placing Packages utilising DNF
Placing packages is the inherent purpose of every package supervisor. To install a confidential package in DNF, run dnf install
obeyed by the package tag:
sudo dnf install nano

The install
subcommand owns several flags that permit you to readjust its default demeanor. For instance, you can require the --setopt=install_weak_deps=False
to skip “Unwell Dependences” when placing a prospectus.

Reminder: Are you peeking to shield your Linux installation? Introduce how to secure documents in Linux via Tomb.
Bring and also Placing RPM Records via DNF
DNF can in addition bring bare .rpm packages from your upstream repo. This can be convenient if you’re arranging an offline machine and also you stab to sideload RPM packages to it.
sudo dnf download emacs
You can also consumption the install
subcommand on your .rpm documents to install it to your machine. Lugging out this will supply you the repayment of dependency resolution for your non-repo packages.
sudo dnf install ~/your-package.rpm

Reinstalling Current Packages
Better, DNF can compel reinstall plans in your existing machine. This can be convenient if you’re having an grouse via an existing package and also you stab to execute sure that you’ve mounted it accordingly.
sudo dnf reinstall nano

The reinstall
subcommand in addition swipes several optional flags which readjust its demeanor. For instance, the --allowerasing
flag will separate any chance dependency battle as shortly as you reinstall your prospectus.
Reminder: learn how you can reparation overstepped package installs in Linux.
Handling Package Teams in DNF
Package groups are a inimitable DNF facility for placing plans about a notion or tool. This can be convenient if you stab to mounted a standing company desktop build or oversaw hodgepodges of software implementation.
To delicacy at the available package groups for your tool, run the subsequent command:
dnf group list

You can dissect the content of a package group by running the info
argument after the group
subcommand. For instance, running dnf groups info Editors
will print a quickly summary of the group and also the packages it will install.

Placing and also Obliterating Package Teams
The group
subcommand in addition takes care of its own installation procedure. Run the group
subcommand via the install
argument, then offer the tag of the group that you stab for your tool:
sudo dnf group install Editors

To separate an entire package group, readjust the install
argument via remove
obeyed by the tag of the group that you stab to separate:
sudo dnf group remove Editors

Filtering system for Accessible Packages
One inestimable facility of every package supervisor is its ability to delicacy via confidential repos for available plans. To do this in DNF, consumption the search
subcommand:
dnf search nano

By default, DNF matches your lookout misgivings to both the confidential package’s tag and also its quickly-term synopsis. You can readjust this demeanor to require with one voice the available metadata areas by encompassing the --all
flag:
dnf search --all nano

Classy Package Surf in DNF
In addition to “lookout,” DNF in addition comes via the repoquery
subcommand which allows you to delicacy for packages and also print them in “NEVRA” style. This is convenient if you’re maturing a script that will install information packages utilising DNF and also RPM.
The subsequent command prints with one voice the available “emacs” packages for Fedora 40 in NEVRA style:
dnf repoquery emacs

Withdrawn from that, the repoquery
subcommand swipes secondary filter flags which you can consumption to construct your package searches. For instance, the --installed
flag will only underscore packages on your machine and also the --depends
will print that package’s dependences:
dnf repoquery --installed --depends emacs

Bring Package Lists in DNF
The list
subcommand is a functional strategy of trowelling via the available DNF packages from your area machine and also confidential repos. For instance, the subsequent command checklists with one voice the mounted packages in your tool.
dnf list --installed

Indistinguishable to repoquery
, the list
subcommand can snag secondary filter flags, such as --recent
, that will print the the majority of existing packages available on your confidential repos.
dnf list --recent
Better, the list
subcommand can in addition be a convenient tool to immediately dissect on the available upgrades for your tool:
dnf list --upgrades

This facility in addition prolongs to DNF’s maintenance-oriented subcommands. For instance, the --autoremove
flag checklists with one voice the hanging dependences on the tool:
dnf list --autoremove
Overhauling System Packages
With DNF, you can upgrade with one voice mounted packages via one subcommand: upgrade
. This strategies that modernizing the tool repeatedly foreseen that you’ll acquire the latest available variation of your packages:
sudo dnf upgrade

If you merely stab to dissect for modernizes, consumption the check-update
subcommand instead:
sudo dnf check-update
Dashing Marginal System Upgrades
Withdrawn from that, DNF can do “traditional upgrades” wherein it will only install defense and also parasite solves for existing plans. This is convenient when you’re running a necessary solution, and also you wear’t stab to introduce going beyond renovations to the machine:
sudo dnf upgrade-minimal

FYI: learn how to preserve your documents from tragic actors by placing some of the above reproach Linux-libre distros today.
Overhauling and also Downgrading Individual Packages
That asserted, you can upgrade individual packages by presenting their tag after the upgrade
subcommand. For instance, the subsequent modernizes GNU Emacs to variation 29.3 in Fedora 40:
sudo dnf upgrade emacs-1:29.3-6.fc40.x86_64

Conversely, DNF in addition confirms misusage packages unleashed that a lesser variation exists in a currently feisty confidential repo:
sudo dnf downgrade emacs
Chit: Dashing the downgrade
subcommand will lesser the variation number of any package that is a hard dependency to your prospectus.
Earning utilise of Rebuttal Advisories to Upgrade Packages
Rebuttal advisories are a necessary component of keeping upwards to day via the latest software implementation susceptibilities. To this run out, DNF lends the --advisory
and also --cve
flags which accepts Fedora Rebuttal Advising codes and also CVE ID numbers.
For instance, the subsequent command upgrades the xz collection in a Fedora 40 tool to address a significant-handed defense exploit:
sudo dnf upgrade --refresh --advisory=FEDORA-2024-d02c7bb266
Uninstalling System Packages utilising DNF
To uninstall packages, the remove
subcommand will separate packages from your tool:
sudo dnf remove nano

Indistinguishable to Debian and also Ubuntu, DNF lends a subcommand for eradicating “hanging” dependency files. To separate these undue packages from your machine, run the subsequent:
sudo dnf autoremove
Obliterating Package and also Database Metadata
Withdrawn from hanging dependences, DNF in addition advances secondary metadata and also cache files when you install or readjust a package. This can be an grouse if you stab to preserve enfranchisement on a storage space-banned machine.
To reparation this, run the clean
subcommand obeyed by “with one voice”:
sudo dnf clean all

The clean
subcommand can in addition separate information cache files instead of eradicating every little thing at when. For instance, you can run dnf clean
via the “packages” argument to separate with one voice cached package files without detaching any metadata:
sudo dnf clean packages
In addition to “with one voice” and also “packages,” dnf clean
accepts “dbcache,” “run out-cache,” and also “metadata.” The first dislodges the cached metadata, the second burdens a cache validation dissect, and also the 3rd deletes the metadata altogether.
Diligent to recognize: learn some of the above reproach means to snugly delete files in Linux.
Yawping Ago System Amendments in DNF
Another fulcra facility of DNF is its ability to go via its own package supervisor history and also undo the renovations that it did to the tool. This can be convenient if you’ve offered a misstep while configuring your machine and also you stab to revert to a previous tidy declare.
To prelude, print the existing history log for your tool:
dnf history
Locate a time in your tool wherein you stab to rumble ago to. In my capsule, I will pick rumble ago my tool to merely in days gone by I mounted Emacs.

Render consumption the ID number of your transaction time, then run the subsequent command to prelude the rumble ago:
sudo dnf history rollback ID-NUMBER
Mirror that DNF owns blown upwards your tool ago to your transaction time by running: dnf history
.

You can in addition separate individual dealings by utilising the “undo” argument. For instance, the subsequent command dislodges Emacs on my tool but doesn’t touch my later NodeJS installation:
sudo dnf history undo ID-NUMBER
Chit: The undo argument carries out the opposite of the transaction command in dnf history
. This strategies that you can run dnf history undo
on a dnf remove
command to reinstall an wear package.
Unravelling Current System Packages
The DNF package supervisor in addition lends gizmos and also flags to evaluate RPM packages on both area and also confidential repos. For instance, the dnf info
command display screens a clarified synopsis of any RPM documents:
dnf info nano

Withdrawn from reading a package’s precisions, you can in addition consumption DNF to dissect wherein a information config documents or binary came from. To do this, run the provides
subcommand obeyed by the outright trail of the documents that you’re studying:
dnf provides /usr/bin/less

Handling Databases in DNF
Databases are the lifeline of the every package supervisor. They serve as your machine’s source of new packages and also modernizes. To this run out, DNF in addition lends a wealth of gizmos to oversaw repo overseeing compeling the ability to have, separate, and also toggle them at will.
To have a new repository for DNF, run the config-manager
subcommand via the --add-repo
flag obeyed by the URL of your 3rd-party repo. For instance, the subsequent command will have the Tailscale repository to your Fedora tool:
sudo dnf config-manager --add-repo=https://pkgs.tailscale.com/stable/fedora/tailscale.repo
You can list with one voice the feisty repositories as nicely as their repo ID in your tool by running: dnf repolist --enabled
.

To maim an feisty repository, run config-manager
via the --disable
flag obeyed by the ID of the repo that you stab to maim:
sudo dnf config-manager --disable tailscale-stable
Chit: You can re-make it possible for a devitalized repository by utilising the --enable
flag along via the devitalized repo’s ID.
Obliterating an Agile Database in DNF
Prelude by running the subsequent command to list with one voice the available repos in the tool along via their documents paths:
grep -E "^[.*]" /etc/yum.repos.d/*
Locate the repo that you stab to separate from the list, then plagiarize it to your clipboard. In my capsule, I will separate the Tailscale DNF repository from my machine.

Glean rid of the .repo documents from your tool by running sudo rm
obeyed by the documents trail in your clipboard.
Run sudo dnf check-update
to reinvigorate your machine’s repository checklists.

Witnessing the basics of DNF is merely the first reaction in licensing the intricate planet of package companies in Linux. Find added of this complex ecosystem by peeking at our attentive Linux package supervisor cheatsheet.
Image credit history: Joan Gamell via Unsplash and also Wikimedia Commons. Unanimously alterations and also screenshots by Ramces Red.