赞
踩
[root@bogon ~]# yum install vsftpd
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Error: There are no enabled repos.
[root@bogon ~]#
报错:系统未注册。说明该yum仓库功能无法正常使用,而 RedHat自带的仓库又需要付费才能使用,身为技术人,花钱买技术那是不可能的。
解决办法:更换为Centos-7的yum源
yum list (功能描述:列出所有可用的package和package组)
yum clean all (功能描述:清除所有缓冲数据)
yum deplist httpd (功能描述:列出一个包所有依赖的包)
1)确定redhat操作系统可以上网,如果是在虚拟机上安装的系统,可以讲系统的网络诺配置器改成NAT模式,如图所示,只要主机能上网,则虚拟机中的操作系统就可以上网。
2)下载适合redhat版本的repo文件(本文以CentOS-7为例),下载地址:
repo下载地址
[root@bogon ~]#cp /tmp/pkg/Centos-7.repo /etc/yum.repos.d
[root@bogon ~]# rpm -qa | grep yum
[root@bogon ~]# rpm -e 软件包名称 --nodeps #可以使用简称如 rpm -e yum-* --nodeps
[root@bogon ~]#mv /etc/yum.repos.d/Centos-8.repo /etc/yum.repos.d/Centos-8.repo.backup
查看更改前文件内容:
[root@bogon yum.repos.d]# cat Centos-7.repo # CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 [root@bogon yum.repos.d]#
更改内容:
1)将无效的网络地址删除掉或者注释(本文中采用删除的方式,将内网地址删除掉)
2)将文中的$releasever 替换成 要采用的redhat系统版本号(本文的为7)
其他版本号可以查看网址:CentOS版本号
[root@bogon ~]# vim /etc/yum.repos.d/Centos-7.repo
更改后的Centos-7.repo文件内容:
[root@bogon ~]# cat /etc/yum.repos.d/Centos-7.repo # CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] # CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-7 - Base - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-7 - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-7 - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-7 - Plus - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #contrib - packages by Centos Users [contrib] name=CentOS-7 - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 [root@bogon ~]#
[root@bogon ~]# yum clean all
-bash: /usr/bin/yum: No such file or directory
报错:-bash: /usr/bin/yum: No such file or directory 没有文件或者文件夹
解决方法:需要安装yum命令。执行如下命令:
[root@bogon ~]# rpm -ivh --nodeps https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
结果:
查看可用 yum repolist all 结果如下:
yum源可以正常访问。
重新执行命令清除缓存。
[root@bogon ~]# yum makecache
(注意:Redhat的注册提示信息仍会出现,但可以正常使用yum功能)
因为镜像网站会存在更新,文件位置可能会发生变化,请在使用过程中根据CentOS-7镜像文件信息镜像源网站里的信息自行调整。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。