How to fix yum command not found

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn what causes the error "yum command not found", and how to fix it.

Yum is the default package manager for CentOS and rpm based distros.

If you encounter the error "yum command not found", it simply means that the command yum was not found, and it wasn't able to execute.

At first this may look confusing, but the error is actually indicating there's something wrong with that command.

This error happens in cases when yum is not installed in the machine, it happens also when yum is broken or not added in the PATH.

Step 1 - Check if yum is installed

yum comes pre installed on CentOS and other rpm distros, which means you can use yum without having to install it manually.

If yum stopped working, and yum command doesn't work anymore because of "yum command not found" error. Then you may need to install yum again.

However, before doing that, you need to check if yum is installed on your machine, as this error could be caused because yum is not added to your PATH, which means yum won't work even when installed on your machine.

To check if yum is installed, you can use which command, which is able to show you where yum's binary is if installed.

which yum

For example, in our case yum was not installed.

If yum binary is found but still not working, then you need to configure yum and add it on your PATH in your ~/.bashrc file

To do so, simply run the command below.

export PATH=$PATH:/usr/bin

Step 2 - Install yum

Next, you need to install yum. Since yum package manager is broken, and you are not able to use it, then you need to install yum manually.

yum can be easily installed on CentOS and red hat based distros, by simply downloading the source.

wget --quiet

Next, verify that yum was downloaded correctly. You can view the content of the directory where you downloaded yum.

ls *rpm

And you should be able to see yum-3.4.3-168.el7.centos.noarch.rpm as shown in the screenshot below.

Now you can proceed to install yum-3.4.3-168.el7.centos.noarch.rpm by using the rpm command.

sudo rpm -i yum-3.4.3-168.el7.centos.noarch.rpm

If you get the error "yum-3.4.3-168.el7.centos.noarch.rpm is already installed", when running the command above, you need to force install it with --force command as below.

sudo rpm -i yum-3.4.3-168.el7.centos.noarch.rpm --force

Step 3 - Verify yum installation

Yum is now installed on your system.

Now you need to check yum version by issuing the following command, to verify that yum is working.

yum --version


  Installed: rpm-4.11.3-48.el7_9.x86_64 at 2023-11-24 17:02
  Built    : CentOS BuildSystem <> at 2021-11-24 16:33
  Committed: Michal Domonkos <> at 2021-11-01

  Installed: yum-3.4.3-168.el7.centos.noarch at 2023-11-24 18:24
  Built    : CentOS BuildSystem <> at 2020-10-01 17:03
  Committed: CentOS Sources <> at 2020-09-29

If you got the same output as above, then it means that yum is installed and working.

Step 4 - Use yum

You should be able to use yum and manage packages on your CentOS machine with it.

If you are new to yum, you can run yum --help to get the full list of commands.


In this tutorial, you learned how to fix "yum command not found" on CentOS. For this tutorial, we used CentOS 7. However, this tutorial, applies to other Linux distros that use yum as package manager, and encountering a similar error.