在这里插入图片描述
出现这个问题是因为用mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup备份了一下源,莫名其妙就出错了。
yum repolist all查看源列表:
在这里插入图片描述
显示全部禁用
啥办法也不好使,只能更新国内镜像源,但是没有wget,可以用curl:
在这里插入图片描述
命令:

curl -o /etc/yum.repos.d/CentOS-Base.repo 镜像源下载地址如http://mirrors.163.com/.help/CentOS7-Base-163.repo

下载的是网易镜像:自行查找http://mirrors.163.com/.help/centos.html

然后执行

yum clean all
yum makecache

成功
在这里插入图片描述

参考:
Linux的默认源出现问题无法yum解决办法

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐