Menu
User

DropVPS Team

Writer: Cooper Reagan

How to install DNF command?

How to install DNF command?

Publication Date

05/30/2025

Category

Articles

Reading Time

2 Min

Table of Contents

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.

Linux VPS
U
Loading...

Related Posts