错误:为 repo ‘base’ 下载元数据失败

2020-04-08  本文已影响0人  优秀j

今天因工作需求需要安装centos8系统做测试,但是yum命令使用过程中总是报错,在网上找了找解决方法,如下:

错误:为 repo ‘base’ 下载元数据失败

解决方法:

大家可以按照如下流程修改源
1.备份现有源

mv /etc/yum.repos.d /etc/yum.repos.d.backup

2.设置新的yum目录

mkdir /etc/yum.repos.d

3.安装wget(我没安装,也没事,可能是我以前安装过)

yum install -y wget

4.就是坑了我一晚上的下载配置(大家一定要区分自己的系统版本,不然肯定不通过)

CentOS 5

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

CentOS 6

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

CentOS 7

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

CentOS 8

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

5.清除文件并重建元数据缓存

yum clean all
yum makecache

6.最后更新软件包,这一步要下载安扎ung或升级一百多个软件包,比较费时间,大概三五分钟吧!

yum update -y

注:我后面执行yum makecache还是报这个错误,如下图,咱也不知道啥原因,试了好多次都是这样,然后同事机缘巧合把路由器线踢松了,导致我网断了,xshell重新连接上又执行就成功了,网络原因吗???


原文链接:https://blog.csdn.net/VictorIs/article/details/104400362/

上一篇 下一篇

猜你喜欢

热点阅读