Yum command not found on CentOS/RHEL server

rhel7
centos7

#1

This is a new problem I am getting whenever I run yum install htop, I am getting the following error on my screen:

-bash: yum: command not found

How do I fix this error on a CentOS 7 Linux server?


#2

Yum is located at /usr/bin/yum. Make sure yum is in path:

echo "$PATH"

You can always set path as follows:

export PATH=$PATH:/usr/bin

For root user PATH should be as follows:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

Make sure yum can be located:

type -a yum

Once found you can run it as follows:

yum update
yum install htop
/usr/bin/yum update

If yum is missing you can install it from DVD/CD. You need to locate a package called yum*.rpm and install it with:

rpm -ivh /path/to/cdrom/yum*.rpm