How to install DNF command?

If you’re working with an older CentOS or RHEL system, chances are you might not have the DNF (Dandified YUM) package manager installed. Here’s how to get it up and running.

Step 1: Check if DNF is already installed

Run:

dnf --version

If you get a version output, you already have DNF installed.

If you get a command not found, follow along.

Step 2: Install EPEL repository (if not present)

Older systems might need access to EPEL before DNF is available.

sudo yum install epel-release -y

Update your package list:

sudo yum update -y

Step 3: Install DNF

Now install DNF using YUM:

sudo yum install dnf -y

That’s it. You can now verify the installation again with:

dnf --version

Extra Tip: Replace YUM with DNF

If you want to start using DNF by default, you can set an alias in your shell config:

For Bash:

echo "alias yum=dnf" >> ~/.bashrc
source ~/.bashrc

Now whenever you type yum, DNF will run instead.

Notes for CentOS 7 or RHEL 7 users

  • DNF is available in CentOS 7 and RHEL 7, but not the default.

  • 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.

Bonus: Install a package with DNF

Just to test things out:

sudo dnf install htop -y

This should install htop and confirm that DNF is working correctly.

Share:

More Posts

How to Install Maven on macOS 2025

What you will read?1 Check for Java Installation2 Install Homebrew (If Not Installed)3 Install Maven via Homebrew4 Verify Environment Variables (Optional)5 Create a Sample Maven

How to Use Google SMTP Server

What you will read?1 Step 1: Enable SMTP Access in Gmail2 Step 2: Secure Connection with TLS3 Step 3: Send an Email via SMTP4 Step

how to install wine on RHEL

What you will read?1 Check RHEL version and CPU architecture2 Update system and install base tools3 Verify subscription and enable CodeReady Builder4 Enable EPEL repository5

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments