使用yum安装报错:Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&

问题现象:

使用yum安装报错:Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&
在这里插入图片描述

排查思路:

1.测试是否是网络问题

经排除网络无问题

2.尝试更新yum

出现一样的报错

3.仓库停服

出现这个错误是因为使用的 CentOS 7 仓库已经被归档,当前的镜像地址无法找到所需的文件。CentOS 7 的官方支持已经结束,部分仓库已被移至归档库。这导致了你的 yum 命令无法找到所需的元数据文件。CentOS 7 的官方仓库在 2024 年 6 月 30 日之后已经停止维护。因此,使用最新的 CentOS 7 官方仓库可能会遇到问题。

解决办法:

修改仓库指向

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

镜像更改为阿里云
再次执行,已经成功了
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/yuzhangfeng/article/details/142070338