Redhat 7.6更换yum

所需要的rpm安装包
https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/

找出以下安装包链接 wget 或 curl -O (版本不同 请自行查找)
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-3.4.3-161.el7.centos.noarch.rpm
yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
yum-utils-1.1.31-50.el7.noarch.rpm
python-urlgrabber-3.10-9.el7.noarch.rpm

清除原yum
rpm -qa | grep yum
rpm -qa | grep yum | xargs rpm -e --nodeps
rpm -ivh python-urlgrabber-3.10-9.el7.noarch.rpm
rpm -ivh yum-* --force --nodeps

将现有的redhat .repo的包重命名,再下载阿里云的.repo到/etc/yum.repos.d目录下
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

修改刚下载的.repo文件,将里面所有$releasever替换为7
vim CentOS-Base.repo
:%s/$releasever/7/g

yum clean all
yum makecache
yum update

你可能感兴趣的:(运维)