本文主要是介绍RedHat7更换Yum源,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
清除旧 yum 版本
rpm -qa|grep yum
rpm -qa|grep yum|xargs rpm -e --nodeps
下载安装centos的yum文件
mkdir yum_temp && cd yum_tempwget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm --no-check-certificate
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm --no-check-certificate
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm --no-check-certificatewget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm --no-check-certificaterpm -ivh *.rpm --force --nodepscd .. && rm -rf yum_temp
下载替换centos源
rm -rf /etc/yum.repos.d/*
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# -O指定文件
sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo
清缓存
yum clean allyum makecacheyum list# 更新软件包(可不操作)(不建议操作,更新后有问题还没解决)
yum update -y
这篇关于RedHat7更换Yum源的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!