redhat更换centos yum源
1、卸载redhat自带的yum软件包
rpm -aq | grep yum |xargs rpm -e --nodeps
2、下载对应的rpm包
先下载包
https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/wget-1.14-18.el7_6.1.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
3、安装
rpm -Uvh *.rpm --nodeps --force
4、获取repo配置文件
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
或
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
最后:
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
shift+: 编辑 输入下面的指令
%s/$releasever/7/g
yum clean all
yum makecache
本文指导如何在Red Hat系统上通过下载并安装aliyun镜像源,将yum源从官方切换到CentOS,包括卸载原有yum包、下载必要的rpm包、安装和配置repo文件,最后清理缓存并更新软件包。
1994

被折叠的 条评论
为什么被折叠?



