If you’re encountering the “bash: yum: command not found” error, it typically means that the YUM package manager is not installed on your system or the directory containing the yum executable is not included in your system’s PATH variable.
Let’s explore the reasons for this error in detail and learn the possible fixes.
Why “yum: command not found” Occur?
The most common reasons for the “yum command not found” error are:
- YUM not Installed: If you are unable to use the “yum” command, it could be that your system does not have the YUM package manager installed.
- PATH Configuration: The PATH on your system may not contain the path of “yum”.
- Permissions: If you’re encountering this error as a non-root user, it could be due to insufficient permissions.
How to Solve “yum: command not found” Error?
Follow the below methods to solve the “yum: command not found error” in Bash:
1. Add “yum” to PATH Variable
If YUM is installed but still the command isn’t found, it could be due to the YUM binary not being in the system’s PATH. In that case, you need to adjust the PATH environment variable. Follow the below steps to do that:
- Open the Bash terminal.
- Use the command below to check where yum is installed:
which yum
- Now, add the path of yum executable into the PATH:
export PATH=$PATH:/usr/bin/yum
After applying the above solution, the error will be solved if it is due to a missing path variable.
Note: This method adds the PATH temporarily. If the method solves the problem, you can set the PATH variable of YUM permanently.
2. Install YUM
Most of the time, “bash: yum: command not found” occurs when the YUM package manager is not installed, or broken. In this instance, you need to install the YUM package manager to solve the error. To install YUM, follow the steps:
- Download the RPM file of YUM package manager for your Linux distribution.
- Install the package using dnf or rpm command:
sudo dnf install <path/of/yum/rpm/file>
Or,
sudo rpm -i <path/of/yum/rpm/file>
Note: If you get the error yum is already installed when running the command above, you need to force install it with--force
. For example:sudo rpm -i <path/of/yum/rpm/file> --force
- Check if yum is working using:
yum --version
After installation, the yum command is executed successfully.
How to Set the PATH Variable for YUM Permanently?
To set the PATH variable for “yum” permanently, you need to add the directory of yum executable into the ~/.bashrc file. Follow the steps to do that:
- Open bashrc file using:
nano ~/.bashrc
- Now paste the below lines at the end of the file:
export PATH=$PATH:/usr/bin export PATH=$PATH:$(which yum)
- Press CTRL+S to save, and CTRL+X to exit.
- Finally, reload the .bashrc file using:
source ~/.bashrc
Conclusion
In conclusion, resolving the “bash: yum: command not found” issue involves ensuring the installation of the YUM package manager and configuring the system’s PATH appropriately. Applying these solutions allows you to seamlessly access yum commands within the Bash environment and streamline package management tasks in your RHEL, Fedora, or CentOS.
People Also Ask
What does “yum: command not found” mean?
The “yum: command not found” means the system is unable to find the YUM command, which is a package manager used primarily in RPM-based Linux distributions.
How to solve “yum: command not found” in CentOS 8?
To solve “yum: command not found” in CentOS, download the rpm package of YUM for CentOS using:
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
Then, install it using dnf or rpm package manager. If the problem still exists, add yum to the PATH variable using:
export PATH=$PATH:$(which yum)
How to solve “yum: command not found” in Fedora 39?
To solve “yum: command not found” in Fedora 39, install YUM using sudo dnf install yum
. Then, add yum to the PATH variable using export PATH=$PATH:$(which yum)
Related Articles
- [Fixed] “bash: sudo: command not found” Error
- [Solved] Bash “yarn” Command Not Found Error
- [Solved] Bash “docker” Command Not Found Error
- [Fixed] “bash: ng: command not found” Error
- [Fixed] “bash: java: command not found” Error
- [Solved] “bash: vim: command not found” Error
- [Fixed] “bash: curl: command not found” Error
- [Solved] “bash: node: command not found” Error
- [Solved] “bash: code: command not found” Error
- [Fixed!] “systemctl command not found” Error in Linux
<< Go Back to [Solved] “bash: command not found” Error | Bash Error Handling and Debugging | Bash Scripting Tutorial
FUNDAMENTALS A Complete Guide for Beginners
hi
how to yum update centos 8? i need video files