How to Fix Yum Command Not Found

how to fix yum command not found

This guide will teach you how to resolve the “yum command not found” error and what causes it.

The package manager by default for CentOS and rpm-based distributions is Yum.

The error “yum command not found” merely indicates that the command could not be discovered and could not be executed.

Although this may appear puzzling at first, the error is simply telling you that there is a problem with that command.

This issue occurs when yum is not added to the PATH, is faulty, or is not installed on the system.

Rectify the missing yum command

Step 1: make sure Yum is installed.

On CentOS and other rpm distributions, yum is pre-installed, thus you don’t need to manually install it in order to use it.


In the event that yum stops functioning and the “yum command not found” error prevents you from using the yum command. Then, you might have to reinstall Yum.


But before you do that, make sure that yum is installed on your computer. If it isn’t, this issue may be the result of yum not being added to your PATH, which means that even if it is installed, it won’t function.


Use the which command to see where yum’s binary is located if it is installed in order to determine whether yum is installed.


which yum


For instance, Yum was not installed in our situation.


You must set up yum and add it to your PATH in your ~/.bashrc file if the yum program is discovered but is still not functioning.


All you have to do is execute the command below.


export PATH=$PATH:/usr/bin


Step 2:Install Yum

The next step is to install Yum. You must manually install yum since the yum package manager is malfunctioning and you are unable to use it.

By just downloading the source, Yum may be installed quickly on Red Hat and CentOS-based distributions.


wget --quiet


Next, confirm that Yum downloaded successfully. The content of the directory from which you downloaded Yum is viewable.


ls *rpm


And as the screenshot below indicates, you ought to be able to see yum-3.4.3-168.el7.centos.noarch.rpm.


Using the rpm command, you can now install yum-3.4.3-168.el7.centos.noarch.rpm.


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


Should you see the error “yum-3.4.3-168.el7.centos.noarch.rpm is already installed” while executing the aforementioned command, you must utilise the –force command as demonstrated below to force install it.


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


Step 3: Check the installation of Yum

Your system now has Yum installed.

To make sure yum is operating properly, you must now run the following command to check the version of yum.


yum --version


It indicates that yum is installed and operational if you received the identical output as before.


Step 4: Make use of Yum

It should be possible for you to use yum to manage packages on your CentOS system.


If you’re unfamiliar with yum, you may obtain the complete list of commands by running yum –help.


In summary

You discovered how to resolve the CentOS error “yum command not found” in this guide. CentOS 7 was used for this lesson. This lesson, however, is applicable to other Linux distributions that experience a similar problem and use yum as their package management.


Leave a Reply

Your email address will not be published. Required fields are marked *