linux为repo ‘AppStream’下载元数据失败
显示错误
- 为 repo ‘AppStream’ 下载元数据失败
- 错误:为 repo ‘AppStream’ 下载元数据失败
解决
查看网络有无连接,或者防火墙。
Centos8下载元数据失败(Cannot download repomd.xml: Cannot download repodata/repomd.xml)
背景
新装了Centos8操作系统,安装yum-utils时报错。
[parallels@localhost yum.repos.d]$ sudo yum install -y yum-utils
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://mirror.cloud.aliyuncs.com/centos-vault/8.5.2111/AppStream/x86_64/os/repodata/repomd.xml [Could not resolve host: mirror.cloud.aliyuncs.com]
错误:为仓库 ‘appstream’ 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
问题分析
经查询,CentOS8操作系统版本生命周期结束,Linux社区不再维护,需要还源。
解决办法
将yum源换为国内流行的阿里云
1)备份
cd /etc/repos.d/ sudo rename '.repo' '.repo.bak' /etc/yum.repos.d/*.repo
2)从阿里云下载从阿里云下载
sudo wget https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo -O /etc/yum.repos.d/Centos-vault-8.5.2111.repo sudo wget https://mirrors.aliyun.com/repo/epel-archive-8.repo -O /etc/yum.repos.d/epel-archive-8.repo
3)替换源链接
sed -i 's/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo sed -i 's/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g' /etc/yum.repos.d/epel-archive-8.repo
4)清除并更新缓存
yum clean all && yum makecache
5)验证
sudo yum update
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持IT俱乐部。