Red Hat Enterprise Linux Server release 7.6 (Maipo)改用CentOS7 yum源

  sre


系统版本

[root@test]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.6 (Maipo)

yum版本

[root@test]# rpm -qa | grep yum
yum-utils-1.1.31-50.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-langpacks-0.4.2-7.el7.noarch
yum-rhn-plugin-2.0.1-10.el7.noarch
yum-3.4.3-161.el7.noarch
PackageKit-yum-1.1.10-1.el7.x86_64

删除yum

[root@test]# rpm -qa | grep yum | xargs rpm -e --nodeps
warning: /etc/yum/pluginconf.d/langpacks.conf saved as /etc/yum/pluginconf.d/langpacks.conf.rpmsave

下载最新的CentOS软件包
浏览器打开https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/
核对一下以下软件包版本,建议下载最新的软件包。

加上–force参数强制安装

cd /root/
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm  
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm   
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm 
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm 
rpm -ivh *.rpm --force --nodeps

下载阿里yum镜像配置

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

编辑yum配置文件
将所有$releasever替换为7

vim /etc/yum.repos.d/CentOS-Base.repo
:%s/$releasever/7/g
:x

更新yum源

yum clean all 
yum makecache
yum update -y

LEAVE A COMMENT

Captcha Code