阿里云CentOS 8.x系统yum报404的解决方法

Posted wemux

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了阿里云CentOS 8.x系统yum报404的解决方法相关的知识,希望对你有一定的参考价值。

进入cd /etc/yum.repos.d/路径下

对文件进行重命名备份

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

新建一个bak文件夹

mkdir bak

.bak文件移动到bak文件夹下

mv *.bak /etc/yum.repos.d/bak

下载最新的repo文件

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

替换repo文件中的链接

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

重新创建缓存,若没报错,则正常了

yum clean all && yum makecache

以上是关于阿里云CentOS 8.x系统yum报404的解决方法的主要内容,如果未能解决你的问题,请参考以下文章

如何排查CentOS 7执行yum命令失败问题?一文说透!

centos6系统yum安装报错The requested URL returned error: 404 Not Found

CentOS 7 执行 yum 命令失败问题的排查

CentOS 7 执行 yum 命令失败问题的排查

在CentOS7上安装vim编辑器报错无法解析阿里云主机

CentOS 7的yum更换为国内的阿里云yum源