redhat7 替换yum源
本贴参照源文:https://www.cnblogs.com/fuhai0815/p/9294848.html
因163源路径变更,尝试后更正如下:
Redhat 7自带的yum源需要付费注册,未注册情况下会报如下错误,且用yum repolist all检查源数目为0。这时候需要将RedHat 7自带的yum源 替换成CentOS 7免费源
一,使用网易163开源镜像站 http://mirrors.163.com/
#1,查看原有yum包
rpm -qa|grep yum
#2,卸载yum包
rpm -qa|grep yum|xargs rpm -e --nodeps
rpm -qa|grep yum
#3,创建下载路径,下载centos7.5 yum包
mkdir /tmp/pkg && cd /tmp/pkg
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-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-50.el7.noarch.rpm
#4,安装下载好的rpm包
rpm -ivh yum-*
rpm -qa|grep yum
#5,替换原有源
cd /etc/yum.repos.d/ &&rm-rfv *
#6,下载163源wgethttp://mirrors.163.com/.help/CentOS7-Base-163.repo
#7,将下载好的文件中的 $releasever 全部修改为目标版本7#为防止出错,以下为改好版本
#8,更新yum clean all &&yum makecache
#9,查看是否更新成功yum repolist all