新闻公告使用手机扫一扫查看
< 返回

CentOS停止维护,更换阿里云镜像源的方法

2024-11-16 23:07 作者:迅马网络 阅读量:92

CentOS官方已全面停止维护CentOS Linux项目,官方网站公告指出CentOS 7已在2024年6月30日结束了生命周期(end of life)。

官方公告:https://blog.centos.org/2023/04/end-dates-are-coming-for-centos-stream-8-and-centos-linux-7/

由于Linux社区已不再维护CentOS 8/7,会出现无法安装系统更新和安全补丁的问题,建议用户更换到AlmaLinux 9/8,可平替CentOS。如果您的业务过渡期仍需要使用CentOS 8/7,请根据下文更换CentOS的官方镜像源为阿里云镜像源。

查看CentOS版本

cat /etc/centos-release

CentOS 8

删除官方镜像源

rm /etc/yum.repos.d/CentOS-Stream-* -f

更换阿里云镜像源

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

CentOS 7

删除官方镜像源

rm /etc/yum.repos.d/CentOS-Base.repo

更换阿里云镜像源

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

最后执行测试命令,安装wget

yum install wget

对于海外云服务器,使用国内yum源可能会造成下载速度慢,推荐使用下面三条命令更新yum源。

cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
联系我们
返回顶部