CentOS-8 - AppStream 错误:为 repo ‘AppStream‘ 下载元数据失败

刚安装的 CentOS8 系统执行yum命令报错

CentOS-8 - AppStream                                                                                
为 repo 'AppStream' 下载元数据失败
错误:为 repo 'AppStream' 下载元数据失败

原因:系统默认的yum源的问题无法请求到

修改yum源配置

1.对原来的yum配置进行备份

rename '.repo' '.repo.bak' /etc/yum.repos.d/*.repo

2.下载最新的阿里云的yum文件

wget https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo -O /etc/yum.repos.d/Centos-vault-8.5.2111.repo && 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/url_tmp/g'  /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/url_tmp/mirrors.aliyun.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo 

sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/epel-archive-8.repo && 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

最后再执行yum安装即可 

猜你喜欢

转载自blog.csdn.net/weixin_42599091/article/details/131421231