centos8 EOL 切换源

455 阅读1分钟

centos8 EOL 切换源

1. 背景

前段时间发现我的服务器的yum无法下载,一直是404错误:

image.png

经过苦苦查找才发现:

CentOS 8操作系统版本结束了生命周期(EOL),Linux社区已不再维护该操作系统版本。

2021年12月31日CentOS 8 EOL。按照社区规则,CentOS 8的源地址http://mirror.centos.org/centos/8/内容已移除,目前第三方的镜像站中均已移除CentOS 8的源。

centos8系列红帽已经停止维护了,默认的yum源已经下架

所以只能更新我的yum源,操作如下:

2. 操作步骤

2.1 登录CentOS 8系统的ECS实例

2.2 运行以下命令备份之前的repo文件

rename '.repo' '.repo.bak' /etc/yum.repos.d/*.repo

2.3 运行以下命令下载最新的repo文件

wget https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo -O /etc/yum.repos.d/Centos-vault-8.5.2111.repo
wget https://mirrors.aliyun.com/repo/epel-archive-8.repo -O /etc/yum.repos.d/epel-archive-8.repo

2.4 运行以下命令替换repo文件中的链接

sed -i 's/mirrors.cloud.aliyuncs.com/url_tmp/g'  /etc/yum.repos.d/Centos-vault-8.5.2111.repo &&  sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/url_tmp/mirrors.aliyun.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo
sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/epel-archive-8.repo

2.5 运行以下命令重新创建缓存

yum clean all && yum makecache

以上就可以正常操作了,鼓捣好久😅