centos 6 更新Yum源

国外centos6的镜像停止维护,阿里云源作为新源修复为新的可用地址方法
1、备份原有源mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下载阿里云源wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo 或

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo

3、替换为阿里云新源地址

sed -i -e ‘s/centos\/\$releasever/centos-vault\/6.10/g’ /etc/yum.repos.d/CentOS-Base.repo

epel源修复:第一步:备份原有源
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup

mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup

2、下载阿里云源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

3、替换为阿里云新源地址
sed -i -e ‘s/com\/epel/com\/epel-archive/g’ /etc/yum.repos.d/epel.repo


命令汇总:

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo

sed -i -e ‘s/centos\/\$releasever/centos-vault\/6.10/g’ /etc/yum.repos.d/CentOS-Base.repo

mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup

curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

sed -i -e ‘s/com\/epel/com\/epel-archive/g’ /etc/yum.repos.d/epel.repo


参考文章

https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b117DQxFM

https://developer.aliyun.com/mirror/epel?spm=a2c6h.13651102.0.0.60381b11jAhAqL

https://help.aliyun.com/document_detail/193569.htmlhttps://developer.aliyun.com/article/779734?spm=a2c6h.14164896.0.0.1dc92e6eqpFBjk

发表评论

邮箱地址不会被公开。 必填项已用*标注