sudo yum install dnf-plugins-core did the trick for me.

UPDATE: on el7, el8, el9 there is a better way

  • when you try to execute dnf config-manager -h it will tell you to try dnf install 'dnf-command(config-manager)'
# centos7
# rocky8
# rocky9
sudo dnf install 'dnf-command(config-manager)'

p.s. the high level solution is actually "try to execute the dnf config-manager -h and if the command fails then read the error message and try installing what the error message recommends".

Answer from nathangiesbrecht on Stack Overflow
🌐
iO Flood
ioflood.com › blog › install-dnf-command-linux
DNF Command in Linux: Installation and Usage Guide
January 2, 2024 - If you see an error message saying ‘DNF command not found’, it means DNF is not installed on your system or it’s not in your system’s PATH. You can install DNF using your distribution’s package manager, as shown in the previous sections.
🌐
Eldernode
blog.eldernode.com › dnf command on centos 8
DNF command on CentOS 8 - what is DNF command - DNF tutorial
September 4, 2024 - By default, DNF Command is pre-installed in CentOS 8. If not installed, you can install it by running the following command:
Discussions

dnf on CentOS 7.9?
Elevate to almalinux or centos stream. More on reddit.com
🌐 r/CentOS
4
3
February 6, 2024
How to resolve "dnf: command not found..." problem on fedora 39
I was trying to remove python environment and I think I accidentally removed the one comes default with fedora and makes dnf command not available. I did(not consecutively but I think those three commands are the relevant ones): sudo rm /bin/python sudo rm /usr/bin/python sudo rm /bin/python3 ... More on discussion.fedoraproject.org
🌐 discussion.fedoraproject.org
6
0
March 11, 2024
Is dnf supported on Centos 7? - Unix & Linux Stack Exchange
dnf has become the default package manager in Centos 8 but the December 2020 RedHat decision about cutting it's support at the end of 2021 has made a lot of us stick with Centos 7, which will get More on unix.stackexchange.com
🌐 unix.stackexchange.com
Can't install htop
So you gotta add a dnf module and then install EPEL-release from a URL, as RHEL doesn't have it in the default repos: dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm``` But! Your subscription doesn't appear to be valid, have you run `subscription-manager register` ? More on reddit.com
🌐 r/linuxquestions
11
0
November 10, 2024
🌐
Reddit
reddit.com › r/centos › dnf on centos 7.9?
r/CentOS on Reddit: dnf on CentOS 7.9?
February 6, 2024 -

We are attempting to work through an upgrade process outlined by OracleLinux to migrate older CentOS 7.9 systems to OL8 instead of fully rebuilding them (we have near 100). However dnf is required to complete the elevate/leapp portion. It looks like dnf is no longer available in many (most) repos and some workarounds have gone offline.

tl;dr: Does anyone know of a repo hosting a copy of dnf 4.x+ that could be leveraged on CentOS 7.9?

🌐
Server Fault
serverfault.com › questions › 1034685 › broken-dnf-in-centos-8
centos8 - broken dnf in CentOS 8 - Server Fault
downloaded the file and installed it manually and it works. curl -o /tmp/libyaml-0.1.7-5.el8.x86_64.rpm 'http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/libyaml-0.1.7-5.el8.x86_64.rpm' sudo rpm -i libyaml-0.1.7-5.el8.x86_64.rpm
🌐
Ask Ubuntu
askubuntu.com › questions › 1285132 › sudo-dnf-command-not-found
software installation - sudo: dnf: command not found - Ask Ubuntu
October 19, 2020 - Ubuntu does not use dnf If you read the instructins on that list you just put in comments, you need to use the Ubuntu commands in that guide - sudo apt install build-essential
🌐
Command Not Found
command-not-found.com › dnf
command-not-found.com – dnf
Package management utility for RHEL, Fedora, and CentOS (replaces yum). For equivalent commands in other package managers, see <https://wiki.archlinux.org/title/Pacman/Rosetta>. More information: <https://dnf.readthedocs.io>.
Find elsewhere
🌐
Fedora Discussion
discussion.fedoraproject.org › ask fedora
How to resolve "dnf: command not found..." problem on fedora 39 - Fedora Discussion
March 11, 2024 - I was trying to remove python environment and I think I accidentally removed the one comes default with fedora and makes dnf command not available. I did(not consecutively but I think those three commands are the relevant ones): sudo rm /bin/python sudo rm /usr/bin/python sudo rm /bin/python3 /bin/python3.12 /bin/python-argcomplete-check-easy-install-script /bin/python-argcomplete-tcsh Then I found that: n349@fedora:~/Downloads$ sudo dnf upgrade Place your right index finger on the fingerpr...
🌐
OSTechNix
ostechnix.com › home › linux distributions › centos › how to install dnf on centos 7
How To Install DNF On CentOS 7 - OSTechNix
July 5, 2022 - This might not be the forum to ask, but I am wondering if anyone knows if there is a reason why modern versions of Centos 7 do not include DNF, given how it has been available in mainstream Fedora for nearly 3 years. Reply ... CentOS is downstream from Red Hat Enteprise Linux, which is still using yum as well. It’s expected that RHEL will include dnf in version 8 which means CentOS will likely include it in version 8 as well.
Top answer
1 of 1
8

There are multiple arguments for the thesis that it is not supported:


Here's what I found:

  • The dnf GitHub project's README provides info how to install it only for Fedora and states "In other RPM-based distributions you need to build all the components from their sources.".

    • ...but it in fact the dnf RPM package for Centos 7 is available in the Centos extras repo, but it is v. 4.0.9, from Nov 2018 (appropriate dnf changelog entry), while the current latest version is 4.5.2 (from Dec 2020).
  • This dnf FAQ entry says that it is safe to install dnf next to yum and provides a tool for migrating the history from yum to dnf ...but the command provided did not work for me as there is no such package as python-dnf-plugins-extras-migrate - this plugin is in the dnf-plugins-core package instead. But after running it with dnf migrate it errored with RuntimeError: Exec failed: no such table: main.trans_cmdline...

  • The Centos wiki page about using dnf on Centos 7 as yum4 - https://wiki.centos.org/SpecialInterestGroup/ConfigManagementSIG/YUM4 - is not up to date as it is referring to Centos 7.5, released in 2018.

  • On the Centos blog the latest info about this is an article from 2018 - https://blog.centos.org/2018/04/yum4-dnf-for-centos-7-updates/ and the last question there - "Is it safe to use yum4/dnf on CentOS 7?" - has been unanswered for more than 1 year (since Dec 2019)...


...on the other hand, there are also arguments for the thesis that it is supported and maybe that support is just well not documented and updated (in a typical open source project way 🙄)?


Arguments for:

  • RedHat Bugzilla does contain bug reports from users of dnf on Centos 7 and RedHat employees did work on them.
🌐
Tech Junction
techjunction.co › home › questions › linux › centos stream 9: bash: dnf: command not found
CentOS Stream 9: bash: dnf: command not found - Tech Junction
April 29, 2025 - 2. Check PATH and Command Availability If dnf is installed but not found, it might be a PATH issue. Check where dnf is located: ... To make it permanent, add the above line to ~/.bashrc or /etc/environment. Try running dnf again. If it still fails, proceed to step 3. 3. Reinstall dnf If dnf ...
🌐
HowtoForge
howtoforge.com › home › centos 8 package management with dnf on the command line
CentOS 8 Package Management with DNF on the Command Line
By default, DNF is pre-installed in CentOS 8 operating system. If not installed, you can install it by running the following command:
🌐
Linode
linode.com › docs › guides › dnf-package-manager
How to Use DNF to Manage Packages in CentOS/RHEL 8 and Fedora | Linode Docs
July 15, 2021 - Before running the commands within this guide, you will need: A system running on CentOS/RHEL 8, AlmaLinux 8, Rocky Linux 8, Fedora 22, or later versions of these distributions. Other Linux distributions that employ the DNF package manager can also be used. Review the Creating a Compute Instance guide if you do not ...
🌐
GetPageSpeed
getpagespeed.com › home › blog › how to fix dnf after centos 8 went eol
How to fix dnf after CentOS 8 went EOL - GetPageSpeed
February 17, 2022 - The vault.epel.cloud is more reliable than vault.centos.org, which has severe downtime issues. The right thing to do now is to upgrade to Rocky Linux 8. If you don’t have any bad packages installed, upgrading is pretty easy: dnf -y upgrade curl https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh -o migrate2rocky.sh chmod u+x migrate2rocky.sh ./migrate2rocky.sh -r reboot
🌐
RootUsers
rootusers.com › home › how to install dnf package manager in centos/rhel
How To Install DNF Package Manager In CentOS/RHEL
January 2, 2017 - $ sudo yum install dnf -y Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirror.airenetworks.es * extras: mirror.tedra.es * updates: mirror.airenetworks.es No package dnf available. Error: Nothing to do ... I forgot to say, my system is: Linux Kernel : Linux 3.10.0-514.26.2.el7.x86_64 x86_64 Linux Version : CentOS Linux release 7.3.1611 (Core)
🌐
Red Hat
bugzilla.redhat.com › show_bug.cgi
1603032 – dnf command not found
July 23, 2018 - Red Hat Bugzilla – Bug 1603032 · This site requires JavaScript to be enabled to function correctly, please enable it · Privacy Contact FAQ Legal
🌐
DropVPS
dropvps.com › home › blog › how to install dnf command?
How to install DNF command? - DropVPS
May 30, 2025 - On CentOS 6 or RHEL 6, it’s not officially supported, but can be compiled manually (not recommended for most users). Fedora already ships with DNF by default since version 22. ... This should install htop and confirm that DNF is working correctly.
🌐
InterServer
interserver.net › home › centos › install dnf in rhel/centos 7
Install DNF in RHEL/CentOS 7 - Interserver Tips
November 5, 2018 - 1) To install DNF on RHEL/CentOS 7 systems, you need to set up and enable epel YUM REPO before installing DNF. ... 3) You can now start to run commands using DNF.