CentOS 7 yum命令“There are no enabled repos”报错的解决方案

CentOS 7 yum命令“There are no enabled repos”报错的解决方案

当在Linux CentOS当中使用yum命令并出现以下报错时:

1
error:There are no enabled repositories in "/etc/yum.repos.d", "/etc/yum/repos.d"

并且使用

1
sudo yum grouplist

后出现报错为

1
2
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.

这种情况一般就是YUM仓库(repository)的配置问题,导致无法正常解析,需要对YUM仓库进行换源。

1. 备份原yum源

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

2. 下载新的yum源

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

3. 更新配置

随后运行以下命令更新配置即可:

1
2
yum clear all
yum makecache

CentOS 7 yum命令“There are no enabled repos”报错的解决方案
http://example.com/2025/05/06/md04/
作者
谢斐
发布于
2025年5月6日
许可协议