How to fix the “Yum command not found” error in Linux [Update 2023]

If you have installed the latest version of RedHat based Linux and trying to run the “yum” command, you may get the “yum command not found error“. But why?? Because yum is obsolete now, “dnf” is the next-generation software package manager in Fedora, CentOS, AlmaLinux, and Rocky Linux.

This article will help you to solve all the below mentioned errors related to Yum –

  • bash: yum: command not found ubuntu
  • Install yum in Linux
  • yum command not found RedHat
  • yum command not found mac
  • sudo: yum: command not found ec2
  • yum command not found fedora
  • yum command not found centos 7

Why am I getting the yum command not found error?

Below mentioned are the possible reasons of yum command error –

  1. You are trying to run the yum” command in Debian based Linux like Ubuntu, Lubuntu, Kubuntu or Linux Mint
  2. You are trying to run the yum command on Legacy Linux e.g. Rhel 4
  3. Yum Utility is not installed by default in your Linux system
  4. You are working on the latest Linux operating system, which uses the dnf package manager by default
  5. Issue with environment variables or operating system got corrupted.

How do I solve the yum command not found error?

To resolve the yum command not found error, you need to identify your Linux distribution and it has been forked from. For example, Ubuntu is Debian based and CentOS 8, AlmaLinux, Fedora and Rocky Linux are RedHat based distros. Keep reading the solutions to get rid of “yum” error.

Note** If you are on CentOS 8, I will suggest you migrate CentOS 8 to AlmaLinux 8.x or Rocky Linux 8.x operating system. CentOS is already declared dead.

Solution-1 Make sure you are running “.rpm” based Linux Distro not Debian based Linux

If you are trying to run the “yum install” command and you are getting an error, then check your distribution is forked from RedHat, not Debian.

For example, if you try to run the yum command on Ubuntu, it will not work and results in the “yum command not found error”. Why? Because these are Debian based Distros and uses “aptpackage manager, not yum.

Now the question arises, can we install and use yum on these Debian based distros? The answer is “Yes” and “No”. You can install Yum also on Debian based OS like Ubuntu using “sudo apt install yum“.

But it doesn’t make sense when you have the apt package manager already and made especially for Ubuntu. Also yum will not be able to manage your packages like apt does.

Run the following command to check the Operating system codename and version

$ sudo cat /etc/os-release


$ sudo lsb_release -d
Check Linux operating system and code version

If it results in RedHat based operating systems as shown in the above image, then you are good to go with the next steps to install the Yum utility presented in Solution 2.

If any other distribution like Ubuntu, Kubuntu or Linux mint is listed. Then use the "apt" command to install packages not yum.

Refer to the following list to get a quick idea of your Linux distribution forked –

DistributionForked from
AlmaLinuxRed Hat Enterprise Linux (RHEL)
Alpine LinuxLEAF Project
ALT LinuxMandrake Linux
antiXDebian, MEPIS
ArchBangArch Linux (UKM Edition)
Arch LinuxIndependent, inspired from CRUX
Bodhi LinuxDebian, Ubuntu
CanaimaDebian, Ubuntu
CentOSRed Hat Enterprise Linux (RHEL)
ChakraArch Linux[10]
Chrome OSGentoo linux
Clear Linux OSIndependent
CrunchBang LinuxDebian
Damn Small LinuxDebian, Knoppix
DebianIndependent, inspired by Softlanding Linux System (SLS)[17]
Debian EduDebian
Dragora GNU/Linux-LibreIndependent, inspired from Slackware
Elementary OSUbuntu, Debian
Emdebian GripDebian
EndeavourOSArch Linux
Fedora LinuxRed Hat Linux
Gentoo LinuxEnoch Linux
Guix System
Hyperbola GNU/Linux-libreArch Linux
Kali LinuxDebian
KodibuntuDebian, Ubuntu
LibreCMCMerged from LibreWRT
Linux MintDebian(LMDE), Ubuntu (main editions)
Linux LiteUbuntu
MageiaMandriva Linux
Mandriva LinuxRed Hat Linux
Manjaro LinuxArch Linux
MIRACLE LINUXRed Hat Enterprise Linux (RHEL)
Musix GNU+LinuxDebian
Novell Open Enterprise ServerSUSE Linux Enterprise Server
OpenMandriva LxMandriva Linux
Oracle LinuxRed Hat Enterprise Linux (RHEL)
Parabola GNU/Linux-libreArch Linux
PardusGentoo (2011.2)
Parrot OSDebian
Parted Magic
PCLinuxOSMandriva Linux
Pop! OSUbuntu
PentooGentoo Linux
Puppy LinuxIndependent, inspired from Vector linux
Qubes OSXen and Fedora
Red Hat Enterprise Linux (RHEL)Red Hat Linux, Fedora
Red Hat Linux
Rocks Cluster DistributionRed Hat Linux
Rocky LinuxRed Hat Enterprise Linux (RHEL)
Sabayon LinuxGentoo Linux
Salix OSSlackware
Scientific LinuxRed Hat Linux, Red Hat Enterprise Linux (RHEL)
SlackwareSoftlanding Linux System (SLS)
SlaxDebian, Slackware (until Slax 9)
SliTaz GNU/LinuxIndependent
Source Mage GNU/LinuxSorcerer
SteamOSDebian (2.0)
 Arch Linux (3.0)
SUSE Linux EnterpriseSlackware, Jurix
Tiny Core LinuxIndependent, inspired by Damn Small Linux
Trisquel GNU/LinuxUbuntu LTS
TurnKey GNU/LinuxDebian
Ubuntu and Derivatives[77]Debian
Univention Corporate ServerDebian
UtutoUtuto XS: Gentoo Linux, Ututo UL: Ubuntu
Void LinuxIndependent, partially inspired by FreeBSD/NetBSD
XandrosCorel Linux
ZentyalDebian, Ubuntu
Zorin OSUbuntu
Table Source: Wikipedia

Solution-2 Install the yum utility, if not installed already in your Linux system

Once you have checked that you are running, RedHat based operating system like Fedora, CentOS, AlmaLinux or Rocky Linux with commands provided in Solution-1. You are good to proceed with the next steps.

If you have the right Linux distro and still you are getting the yum command not found error. Then you can install the yum utility with the following steps.

  • Check whether yum package is installed or not
$ sudo yum

-bash: yum: command not found
yum command not found error in Rocky Linux
$ sudo rpm -q yum

package yum is not installed


# rpm -q yum
check yum package is installed or not

If you get “package yum is not installed” or you have wiped out the yum package by mistake, then install yum using the iso or CD/DVD.

  1. Mount the iso image or use the DVD of your Linux operating system and install the Yum RPM.
$ sudo rpm -ivh /path/to/yum-X.X.X-version.rpm

If you have the latest “.RPM” based Linux distro, you can use dnf also to install the yum utility.

$ sudo dnf -y install yum


# dnf -y install yum
run dnf -y install yum to fix yum command not found error

Solution-3 Avoid using legacy or out of support operating systems

I would recommend you avoid using legacy operating systems, which are already End of life (EOL) for example RedHat Linux 3, RHEL 4 etc. To check the End of life of any Linux distribution, you can visit the respected OS site and get the details.

I am recommending this because the End of Life Linux distribution repository is not updated and sometimes, you won’t be able to get the latest packages or software for your Linux operating system.

If you will use the latest RedHat forked operating systems, then you will never get an error of yum command not found as it will be available by default. Also, you can easily install it using RPMs if required.

Solution-4 Use “dnf” package manager instead of yum

DNF or Dandified YUM is the next-generation version of the Yellowdog Updater, Modified (yum), a package manager for .rpm-based distributions. Starting from RedHat 8 and Fedora 22, It has been the default package manager currently for ec2 instances also.

So if you get an error of “yum command not found“. Then use dnf instead of yum to install packages in your Linux system.

$ sudo dnf -y install yum

Solution-5 Check for $PATH is setup correctly

If you have done everything correct and you are still getting “yum command not found error” in Linux, then give a check to your $PATH entries.

Run following command make sure you have at least these entries as shown in output for root user.

# echo $PATH

If these entries are not there by default, make sure you edit and add these entries to either /etc/environment file or add it end of the ~/.bashrc file of root user.

# PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"
# export PATH

Frequently Asked questions – Yum

Q1 – How do I resolve the yum command not found?

First, check your distro name and version, it must be rpm based distro like Fedora, RedHat, Rocky Linux etc. Then look for the yum package. If it’s not installed, run “sudo dnf install yum” in case of latest Operating system. If you are using legacy OS, then install it from an iso image or CD/DVD using the “rpm -ivh /path to yum package” command.

Q2 – How do I get yum on Linux?

Run the following commands based on your distro-

– CentOS, AlmaLinux, RedHat, RockyLinux

$ sudo dnf install -y yum

– Ubuntu (use “apt” but due to some exceptions, if you need to install yum, then run”

$ sudo apt install yum

Q3 – How do I know yum is installed?

Run the following command –

$ sudo rpm -qa | grep -i yum


$ sudo rpm -q yum

Q4 – What is the command to install yum in Linux?

Following are the commands to install yum in Linux –

– CentOS, AlmaLinux, RedHat, RockyLinux

$ sudo dnf install -y yum

– Ubuntu (use “apt” but due to some exceptions, if you need to install yum, then run”

$ sudo apt install yum


I am sure you would have now resolved the “yum command not found” error by following this tutorial. If nothing is working, you may have corrupt operating system. Just reinstall your operating system, in case you are not able to run any command on your Linux operating system.


I'm Dev, your friendly neighbourhood Tech Savy. I spend my days with gadgets, servers, and the occasional laugh-inducing software mishap. Think of me as your tech-savvy, glitch-prone buddy. If you've got questions, feedback, or just need someone to blame when your Wi-Fi goes haywire, I'm your guy!