今天要用yum安装个软件,发现报错了
CentOS-8 - AppStream 1.3 kB/s | 394 B 00:00
Errors during downloading metadata for repository 'AppStream':
- Status code: 404 for https://repo.huaweicloud.com/centos-vault/centos-vault/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: 59.39.0.152)
Error: Failed to download metadata for repo 'AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
解决方案记录一下:
- 备份一下
cp -r /etc/yum.repos.d ./
- 下载新的CentOS-Base.repo文件到/etc/yum.repos.d/目录下
wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-8-reg.repo
- 修改对应版本号
查看当前版本号
cat /etc/redhat-release
-> CentOS Linux release 8.2.2004 (Core)
将/etc/yum.repos.d/CentOS-Base.repo
文件中的版本号替换成当前版本号
- 清理缓存
yum clean all
- 刷新缓存
yum makecache
刷新如果还报以上错误,可以删掉/etc/yum.repos.d/
下面的其他repo文件只保留/etc/yum.repos.d/CentOS-Base.repo
这一个repo文件然后再刷新缓存即可,我的服务器就是需要删除其他repo