前因: CentOS 8 结束生命周期,需要进行切换源,切换源之后执行命令 yum clean all && yum makecache 得到如下错误信息。 Failed to download metadata for repo ‘AppStream’ Error: Failed to download metadata for repo “AppStream” 原因: 正如给的提示信息,是/etc/yum.repos.d/文件下存在多个配置文件,所以报错提示重复。
解决: 删掉这些原有的文件,重新下载yum源文件即可: cd /etc/yum.repos.d/ rm -rf CentOS-* #删除全部文件,见下方切换方法
CentOS 8 结束生命周期如何切换源
公网用户:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
yum clean all && yum makecache
阿里云ecs用户:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
sed -i 's/mirrors.cloud.aliyuncs.com/url_tmp/g' /etc/yum.repos.d/CentOS-Base.repo && sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/CentOS-Base.repo && sed -i 's/url_tmp/mirrors.aliyun.com/g' /etc/yum.repos.d/CentOS-Base.repo
yum clean all && yum makecache
后果: 重新下载源文件并替换之后,执行yum clean all && yum makecache 安装成功,如下。
|