Redhat7 更換 centos7 yum源

錯誤描述

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. 

解決步驟

刪除redhat原有的yum

rpm -aq|grep yum|xargs rpm -e --nodeps 

下載yum安裝文件

#到這個網站去下載以下RPM包
http://mirrors.163.com/centos/7/os/x86_64/Packages/
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-163.el7.centos.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-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
ll

進行安裝yum

rpm -ivh --force --nodeps python-iniparse-0.4-9.el7.noarch.rpm; rpm -ivh --force --nodeps yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -ivh --force --nodeps yum-3.4.3-163.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
注意:最後兩個包必需同時安裝,不然會相互依賴

設置源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo; cd /etc/yum.repos.d; ll

清除原有緩存

yum clean all

重建緩存,以提升搜索安裝軟件的速度

yum makecache
若是有提示錯誤,運行下面的命令:[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" 
 
sed -i 's/\$releasever/7/' CentOS-Base.repo

 備註:把文件裏的$releasever替換爲7 最後:從新生成緩存,數字不爲0,就OK了node

yum clean all; yum makecache

更新系統

yum update
相關文章
相關標籤/搜索