Redhat替换Centos Yum源

删除当前系统自带的yum

rpm -qa |grep yum
rpm -qa|grep yum|xargs rpm -e --nodeps

下载Cenots Yum源软件

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm

安装

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm 
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm 
rpm -ivh --force python-urlgrabber-3.9.1-11.el6.noarch.rpm
rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm

替换

cd /etc/yum.repos.d/ &&  rm -f *.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo    http://mirrors.aliyun.com/repo/Centos-6.repo && wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-6.repo
sed -i 's/$releasever/6/g'  CentOS-Base.repo
sed -i 's/$basearch/x86_64/g' CentOS-Base.repo
sed -i 's/$basearch/x86_64/g' epel-6.repo
yum clean all && yum makecache fast

 

============================================(20210303)

Centos6 官方停止更新源,yum无法使用后又找了个方法

把CentOS-Base.repo 里面的东西全部删掉,添加如下内容即可

[base]
name=CentOS-6
failovermethod=priority
baseurl=https://vault.centos.org/6.9/os/x86_64/
gpgcheck=0

替换后

yum clean all
yum makecache

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值