使用yum 遇到如下錯誤.
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
因為RedHat yum源是收費的,沒有注冊的Red Hat是不能使用yum源的。
卸載Red Hat原有的yum,安裝centos 7 yum.
# 查看本地yum rpm -qa|grep yum # 清除原有RHEL的YUM及相關軟件包。 rpm -qa | grep yum | xargs rpm -e --nodeps rpm -qa |grep python-urlgrabber|xargs rpm -e --nodeps
下載Centos yum 並安裝.
# 切換目錄 cd /etc/yum.repos.d/ #下載以下四個安裝包 wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-161.el7.centos.noarch.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm # 先安裝python**這個 rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm # 其它三個一起安裝 因為有相互依賴關系 rpm -ivh yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-3.4.3-161.el7.centos.noarch.rpm
下載配置文件
cd /etc/yum.repos.d/ # 以下源二選一 #網易源 wget http://mirrors.163.com/.help/CentOS7-Base-163.repo #中國科技大學源 wget https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=3
備份原配置文件:
cd /etc/yum.repos.d/ mv redhat.repo redhat.repo.bak
更新yum緩存
yum clean all # 清除yum緩存 yum makecache #更新yum緩存
此時遇到了一個錯誤.
查了下因為沒有設置配置文件. 根據上面下載的源 選擇執行語句.
#163源 sed -i "s;\$releasever;7;g" CentOS7-Base-163.repo #中科大源 sed -i "s;\$releasever;7;g" CentOS-Base.repo
設置完成后 重新執行
yum clean all #清除yum緩存 yum makecache #更新yum緩存 yum repolist
看到repolist 顯示軟件包數量就可以了.
完成 Red Hat yum 更換為 Centos yum.