Rhel

-bash: yum: 找不到命令

  • March 3, 2020

我有一台安裝了 Red Hat Enterprise Linux AS 第 4 版(Nahant Update 3)的伺服器。我嘗試使用此連結添加線上回購:

Centos 維基:RPMForge

一切都很順利。但是當我嘗試安裝任何軟體包時,它會回复:

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

有一些回購/etc/yum.repo.d/

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

的內容rpmforge.repo是:

[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

命令結果

[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

經過簡單的檢查,我在回答評論中問過你:

[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

我們可以驗證您的系統中沒有安裝 yum。

請通過安裝它rpm,您將能夠啟動它。

引用自:https://unix.stackexchange.com/questions/76432