-bash: yum: command not found

237,329

Solution 1

After simple checks I've asked you in answer comment:

[root@Backup yum.repos.d]# yum
-bash: yum: command not found
[root@Backup yum.repos.d]# which yum
/usr/bin/which: no yum in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin)
[root@Backup yum.repos.d]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
[root@Backup yum.repos.d]# rpm -q yum
package yum is not installed

we can verify that you don't have yum installed in your system.

Please install it via rpm and you'll be able to launch it.

Solution 2

  1. Go to pkgs.org.
  2. Find the yum rpm package for your rhel version and architecture (x86 or x86_64).
  3. Download the rpm package.
  4. Install with su -c 'rpm -i ~/Downloads/*.rpm or with your graphical package manager.
Share:
237,329
OmiPenguin
Author by

OmiPenguin

Proud to be part of Linux Family.

Updated on September 18, 2022

Comments

  • OmiPenguin
    OmiPenguin over 1 year

    I have one server with Red Hat Enterprise Linux AS release 4 (Nahant Update 3) installed. And I tried to add the online repo using this link:

    Centos Wiki: RPMForge

    And everything goes smooth. But when I tried to install any package it replies:

    [root@Backup yum.repos.d]# yum -v install httpd
    -bash: yum: command not found
    

    There are some repos in /etc/yum.repo.d/:

    mirrors-rpmforge  mirrors-rpmforge-extras  mirrors-rpmforge-testing  rpmforge.repo

    The content of rpmforge.repo is:

    [root@Backup yum.repos.d]# cat rpmforge.repo
    ### Name: RPMforge RPM Repository for RHEL 4 - dag
    ### URL: http://rpmforge.net/
    [rpmforge]
    name = RHEL $releasever - RPMforge.net - dag
    baseurl = http://apt.sw.be/redhat/el4/en/$basearch/rpmforge
    mirrorlist = http://apt.sw.be/redhat/el4/en/mirrors-rpmforge
    #mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
    enabled = 1
    protect = 0
    gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
    gpgcheck = 1
    
    [rpmforge-extras]
    name = RHEL $releasever - RPMforge.net - extras
    baseurl = http://apt.sw.be/redhat/el4/en/$basearch/extras
    mirrorlist = http://apt.sw.be/redhat/el4/en/mirrors-rpmforge-extras
    #mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-extras
    enabled = 0
    protect = 0
    gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
    gpgcheck = 1
    
    [rpmforge-testing]
    name = RHEL $releasever - RPMforge.net - testing
    baseurl = http://apt.sw.be/redhat/el4/en/$basearch/testing
    mirrorlist = http://apt.sw.be/redhat/el4/en/mirrors-rpmforge-testing
    #mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-testing
    enabled = 0
    protect = 0
    gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
    gpgcheck = 1
    

    Command Results

    [root@Backup yum.repos.d]# yum
    -bash: yum: command not found
    [root@Backup yum.repos.d]# which yum
    /usr/bin/which: no yum in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin)
    [root@Backup yum.repos.d]# echo $PATH
    /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
    [root@Backup yum.repos.d]# rpm -q yum
    package yum is not installed
    [root@Backup yum.repos.d]# find /bin/ /usr/bin -name yum
    [root@Backup yum.repos.d]# find /bin/ /usr/bin -name yum*
    [root@Backup yum.repos.d]# ls -l /etc/yum.comf
    ls: /etc/yum.comf: No such file or directory
    [root@Backup yum.repos.d]# ls -l /etc/yum.conf
    ls: /etc/yum.conf: No such file or directory
    
    • NotFromBrooklyn
      NotFromBrooklyn almost 11 years
      Can you give the exact terminal output?
    • OmiPenguin
      OmiPenguin almost 11 years
      I added the information in Question Section
    • OmiPenguin
      OmiPenguin almost 11 years
      I have added the info in Question under Command Results. Seems like yum is not installed
    • rush
      rush almost 11 years
      So you have to install it, and everything will be fine :)
  • OmiPenguin
    OmiPenguin almost 11 years
    Thanks for the information. So this is the reason. I never used rhel4 before so i had no idea about it. I started to learn from rhel5
  • Chaminda Bandara
    Chaminda Bandara about 4 years
    Why this happen ? [root@cpanel1 ~]# passwd -bash: passwd: command not found [root@cpanel1 ~]# passwd -bash: passwd: command not found [root@cpanel1 ~]# yum update -bash: yum: command not found [root@cpanel1 ~]# type yum -bash: type: yum: not found [root@cpanel1 ~]# which yum /usr/bin/which: no yum in (:/root/bin) [root@cpanel1 ~]# echo $PATH :/root/bin [root@cpanel1 ~]# rpm -q yum -bash: rpm: command not found [root@cpanel1 ~]# find /bin /usr/bin -name yum -bash: find: command not found [root@cpanel1 ~]#