Skip to content

Fix: Sudo yum command not found

  • by
  • 3 min read

One of the biggest reasons Linux is so popular is the large number of OS distributions suited to different users’ needs. Whether you want to run a media server or create a programming machine, you can find a specific distro that suits your needs.

As convenient as this is, it also introduces some confusion among beginners about which distro to pick. Different distros also use different tools that can confuse, as some tools that might be the default on one distro might be invalid for another. In this article, we’re talking about the “sudo yum command not found” error, its causes, and what you can do to fix the problem.

Also read: How to count files in a directory in Linux?

What causes the “sudo yum command not found” error?

As the error message reads, the problem arises when the Yum package manager is missing from your Linux distro. There are several reasons why this might happen.

  • Wrong distro: Yum is the default package manager for CentOS, so if you’re trying to run it on Ubuntu or any other Debian-based distro, you’ll run into this error.
  • Invalid or missing Yum installation: Another cause for the error can be an invalid or missing Yum installation.
  • Invalid Yum installation path: If you’ve installed multiple Yum variants or manually installed it somewhere other than the default path, the error can appear when using the command.

How to fix the “sudo yum command not found” error?

Here are three ways you can fix the problem.

Check the Linux distro

Yum is the package manager for Red Hat-based Linux distros. If you’re trying to use it on a Debian-based distro, which uses apt instead, the command will not work. The solution is to check what Linux distro you’re using and run the appropriate command.

Install Yum

While Yum should be installed by default on your Red Hat distro, it’s best to run a clean installation if you’re facing this issue. To do so, run the following command:

sudo dnf -y install yum 

This will use the dnf package manager to install yum. Once the installation is complete, you can use yum without any issues. Do remember that it is advisable to use dnf going forward as yum is now considered a deprecated package manager in RHEL 9.

Check the command path

Last but not least, if you’ve already installed yum but still get the error, you can check the command path to ensure the system knows where the command is installed. You can check your system’s default entry paths using the following command.

echo $PATH

The default path for yum is /usr/bin/yum. If this path is reflected in the output of the aforementioned command, you’re good to go. If you’re not, either install yum in the default path or add the current yum installation’s path to the system using this command.

PATH = "enter/path/here:second/path/here"
export PATH

Once done, restart the system as a precaution and yum should work fine.

Also read: Linux Zgrep command explained

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here:

Exit mobile version