Managing packages on Fedora with DNF

Fedora 22 shipped with a rather significant change under the hood: the introduction of DNF (DaNdiFied YUM) as the default package manager. The change is visible only to users that used YUM to work with Fedora packages. Users that use various graphical tools like Software and Apper should have not noticed any changes.

Basic commands remain the same

While planning the new package manager, the DNF developers aimed to make the transition from YUM to DNF as easy as possible for users. They decided to use a command line syntax which replicated YUM’s commands as much as possible. The basic commands, therefore, are exactly the same. With YUM, for instance, one would run the following command to install a package, in this case, nano:

sudo yum install nano

With DNF, one will run:

sudo dnf install nano

Similarly, to search for a package with YUM, one would use:

sudo yum search nano

With DNF, one would use the similar command:

sudo dnf search nano

Some other basic commands that remain the same are: remove, update, distro-sync, check-update, info, history, reinstall, provides, repolist, list, downgrade, clean, and makecache. Even the corresponding commands pertaining to package groups remain the same: group info, group install, group remove. Common options also remain the same, such as -y to assume “yes” for all questions, and –enablerepo/–disablerepo switches.

DNF plugins for more advanced commands

Advanced users will notice that the text does not yet mention other functions that yum-utils carried out, such as installing debuginfo packages or downloading source RPMs from the repositories. To provide such advanced functionality, DNF uses various plugins which are provided by different packages in the Fedora repositories. The table below documents some of these plugins:

YUM command DNF command Provided by package
debuginfo-install
dnf debuginfo-install
dnf-plugins-core
repoquery
dnf repoquery
dnf-plugins-core
yum-builddep
dnf builddep
dnf-plugins-core
yum-config-manager
dnf config-manager
dnf-plugins-core
yumdownloader
dnf download
dnf-plugins-core
repo-graph
dnf repograph
dnf-plugins-extras-repograph

For a complete list of changes between YUM and DNF, please consult the

yum2dnf

man page.

DNF in the future

Work continues on DNF. The tool improves with each bug fix and release. In the nearfuture, for example, fedup, the Fedora upgrade tool, is to be replaced with a DNF implementation. The implementation is already being tested and will be announced soon. In the meantime, if you do observe unexpected behaviour when using DNF, please file a bug so that the developers can look into it.

Using Software

13 Comments

  1. There used to be yum –skip-broken. Will there be something like that for DNF?

    • Rex Dieter

      dnf ‘s default behavior is the equivalent of ‘yum –skip-broken’

      • Ah, I guess I didn’t understand what skip-broken really meant. I thought it was if one package wasn’t behaving I could still do a dnf update -y and it would complete and then show the ones it couldn’t update. Instead it just fails in that circumstance.

  2. Check also my article with more details: “DNF in Action — Practice Guide for Centos/RHEL/Fedora Package Manager” https://tlhp.cf/dnf-in-action-guide/

  3. Dave Plaza

    man dnf

    suggests that this is already the defaut behavior in the upgrade (what update aliases to) command:

    -b, –best
    Try the best available package versions in transactions. Specifically during dnf upgrade, which by default skips over updates that can not be installed for dependency reasons, the switch forces DNF to only consider the latest packages and possibly fail giving a reason why the latest version can not be installed.

  4. liquidat

    What about

    yum install "*bin/nc"

    . That was a real killer feature but does not work wit dnf.

  5. Hiisi

    What was the main reason of moving from yum to dnf?

    • @Hiisi: One of the more compelling reasons was that yum had become an extremely convoluted codebase, especially in the dependency solver. There had also been advances in computing solutions like dependencies over the years. DNF was an opportunity to take those advances into account, and produce a more flexible and streamlined codebase for future maintenance. You can also read more here.

  6. Can dnf also query packages? Like rpm -qa | dolphin. I only use most basic features of dnf but time to time I have to fall back to rpm.

    • @Sudhir: You can do ‘dnf list installed’ and grep, or ‘dnf list installed \*glob\*’, just as with yum. However, rpm allows more fine grained query controls.

  7. Leslie Satenstein

    For a few weeks, my fingers entered dny instead of dnf.

    I realized that my brain was saying Definitely Not Yum.

    When dnf takes an automated action, for example, “skip broken”, I would like to know what is missing or causing dnf to opt out of the package or rpm file. I haven’t seen how to cause dnf to report why it did the “skip broken”

    But after 6 months of dnf use, I must say that it is, performance wise, and in other ways, an improvement over “yum”.

  8. andre-ghey

    just wanted to mention, that the yum GUI) extender is now for dnf “yumex-dnf”
    It is not stellar yet, but it is very useful.
    A.

  9. Kiiwi

    For a while “dnf” for me has stood for “did not finish”. It has a tendency to break stuff. This message was sponsored by “rpm -Va”.

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions