代码改变世界

CentOS6官方不维护了,更新怎么办?配置阿里云yum源

2021-05-13 11:50  猎手家园  阅读(636)  评论(0编辑  收藏  举报

你的centos6/7是不是不能使用了,报404 not found错?

一、修改yum源为aliyun源

cd /etc/yum.repos.d/

#备份CentOS-Base.repo
mv CentOS-Base.repo CentOS-Base.repo.bak

#修改yum源
#CentOS 6为:
wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

#Centos 7为:
wget -O CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

#Centos 8为:
wget -O CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo


#默认文件会报错,要做一些替换
#把CentOS-Base.repo文件中的以下网址:
http://mirrors.aliyun.com/centos/
http://mirrors.aliyuncs.com/centos/
http://mirrors.cloud.aliyuncs.com/centos/

#修改成:
http://mirrors.aliyun.com/centos-vault/centos/

 

二、下载阿里云的epel源

wget -O epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
wget -O epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
wget -O epel.repo http://mirrors.aliyun.com/repo/epel-8.repo

#默认文件会报错,要做一些修改
#把epel.repo文件中的:
enabled=1

#修改成
enabled=0

 

三、测试

#清空yum缓存
yum clean all

#重建yum缓存
yum makecache

#列出yum列表
yum list

 

最后更新于:2022-06-09