0
点赞
收藏
分享

微信扫一扫

CentOs系统使用yum安装时报错


报的错误如下

Repository epel is listed more than once in the configuration
CentOS-8 - AppStream 7.2 kB/s | 2.3 kB 00:00
Errors during downloading metadata for repository ‘AppStream’:
Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: 100.100.2.148)
Error: Failed to download metadata for repo ‘AppStream’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

CentOs系统使用yum安装时报错_centos


原因

阿里云修改了镜像

​​解决方案​​

运行以下命令备份之前的repo文件。

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

运行以下命令下载最新的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


举报

相关推荐

0 条评论