centos7停止维护后更换yum源教程

centos7已经在2024年6月30日,生命周期结束,官方不再进行支持维护,如果使用官方yum源下载环境服务,会报404。这里提供了可用的yum源及配置教程,教程非常简单,连接服务器SSH后,按照教程步骤执行完命令即可。

1, 备份当前 Yum 源

在更换 Yum 源之前,建议先备份当前的 Yum 源配置文件,以防万一。执行以下命令:

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

这将备份当前的 Yum 源配置文件为 CentOS-Base.repo.bak。

2, 下载新的 Yum 源配置文件

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

这里下载的是阿里云的centos7 yum源。

或者:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://file.kangle.cccyun.cn/repo/Centos-7.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://file.kangle.cccyun.cn/repo/Centos-7.repo

3, 清除 Yum 缓存

yum clean all

4, 生成新的缓存

yum makecache

教程到这里就结束了,现在您可以执行yum命令测试能否正常下载环境。

 
 
© 版权声明
THE END
喜欢就支持一下吧
点赞7 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容