一、错误重现
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也报相同错误可以使用相同方法。 |
发表评论