当前位置: 代码网 > 服务器>服务器>Linux > CentOS 8中 更新或下载时报错:为仓库 ‘appstream‘ 下载元数据失败 : Cannot prepare internal mirrorlist

CentOS 8中 更新或下载时报错:为仓库 ‘appstream‘ 下载元数据失败 : Cannot prepare internal mirrorlist

2024年07月31日 Linux 我要评论
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=container [Could not resolve host: mirrorl

一、错误重现

centos stream 8 - appstream                                                                0.0 b/s | 0 b 00:00
errors during downloading metadata for repository 'appstream':
      - curl error (6): couldn't resolve host name for http://mirrorlist.centos.org/?release=8-stream&arch=x86_64&repo=appstream&infra=stock [could not resolve host: mirrorlist.centos.org]
错误:为仓库 'appstream' 下载元数据失败 : cannot prepare internal mirrorlist: curl error (6): couldn't resolve host name for http://mirrorlist.centos.org/?release=8-stream&arch=x86_64&repo=appstream&infra=stock [could not resolve host: mirrorlist.centos.org]

或者

failed to set locale, defaulting to c.utf-8
centos linux 8 - appstream                                                                0.0 b/s | 0 b 00:00
errors during downloading metadata for repository 'appstream':
     - curl error (6): couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=appstream&infra=container [could not resolve host: mirrorlist.centos.org]
error: failed to download metadata for repo 'appstream': cannot prepare internal mirrorlist: curl error (6): couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=appstream&infra=container [could not resolve host: mirrorlist.centos.org]

进入仓库源文件夹下

cd /etc/yum.repos.d/

修改镜像配置内容

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/centos-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/centos-*

清空原有缓存,并重新生成

yum clean all && yum makecache

更新软件包

yum update -y

在这里插入图片描述


成功解决了!

如果centos 7也报相同错误可以使用相同方法。
(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com