【已解决】Error: Failed to download metadata for repo ‘appstream‘: Cannot prepare internal mirrorlist

简介: 【已解决】Error: Failed to download metadata for repo ‘appstream‘: Cannot prepare internal mirrorlist

✨在学习使用 docker 技术过程中,基于 centos 镜像自定义新的镜像,其中基础镜像 centos 需要提前安装好 vim 和 net-tools,然而在刚开始通过 yum -y install vim 安装 vim 时,便出现了错误提示信息:

2e718f6de6d94987ae2f2182c528d9c8.png

Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

✨上面的报错信息意思是,从仓库 ‘appstream’ 下载元数据失败:由于镜像列表中没有 URL,不能准备内部镜像列表。


🥎问题分析:


✨第一种可能的情况便是网络连接问题。检查是否可以连接外部网络,可以使用 ping baidu.com 查看是否有丢包情况。如果丢包,则进一步检查网络连接是否正常;如果没有丢包,继续阅读下文

✨那么第二种情况,便是 CentOS 已经停止维护的问题。2020 年 12 月 8 号,CentOS 官方宣布了停止维护 CentOS Linux 的计划,并推出了 CentOS Stream 项目,CentOS Linux 8 作为 RHEL 8 的复刻版本,生命周期缩短,于 2021 年 12 月 31 日停止更新并停止维护(EOL),更多的信息可以查看 CentOS 官方公告。如果需要更新 CentOS,需要将镜像从 mirror.centos.org 更改为 vault.centos.org

🥎那么针对上面提到的第二种情况,给出的解决方法如下:


🔔 首先,进入到 yum 的 repos 目录

cd /etc/yum.repos.d/

🔔其次,修改 centos 文件内容

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
  • 🔔 然后,生成缓存更新(第一次更新,速度稍微有点慢,耐心等待两分钟左右)
yum makecache
  • 🔔 最后,运行 yum update 并重新安装 vim
yum update -y
yum -y install vim
相关文章
关于 CentOS8出现“Error: Failed to download metadata for repo ‘AppStream‘: xxxx” 的解决方法
关于 CentOS8出现“Error: Failed to download metadata for repo ‘AppStream‘: xxxx” 的解决方法
关于 CentOS8出现“Error: Failed to download metadata for repo ‘AppStream‘: xxxx” 的解决方法
|
6月前
centos8 Failed to download metadata for repo ‘base‘: Cannot download repomd.xml
centos8 Failed to download metadata for repo ‘base‘: Cannot download repomd.xml
188 1
问题提解决:ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host=‘files.pythonhos
问题提解决:ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host=‘files.pythonhos
|
4月前
|
缓存 Linux 开发工具
【各种问题处理】Error: Failed to download metadata for repo ‘appstream‘
【1月更文挑战第13天】【各种问题处理】Error: Failed to download metadata for repo ‘appstream‘
|
Linux 开发工具 Docker
Docker报错: Failed to download metadata for repo ‘appstream‘: Cannot prepare internal mirrorlist
Docker报错: Failed to download metadata for repo ‘appstream‘: Cannot prepare internal mirrorlist
251 0
|
Linux Go
centos8 appstream大坑Failed to download metadata for repo appstream: Cannot prepare internal mirrorlis
centos8 appstream大坑Failed to download metadata for repo appstream: Cannot prepare internal mirrorlis
252 0
解决helm部署报错Error: UPGRADE FAILED: another operation (install/upgrade/rollback) is in progress
在使用helm install 或者helm upgrade的时候,如果出现了异常中断操作, 经常会出现UPGRADE FAILED并且导致后续无法更新,那我们该如何处理呢?
4060 0
错误:为 repo ‘appstream‘ 下载元数据失败 : Cannot prepare internal mirrorlist: No URLs in mirrorlist
repos.d中更新一下源,使用vault.centos.org代替mirror.centos.org。执行以下两行代码进行修改。
795 2
错误:为 repo ‘appstream‘ 下载元数据失败 : Cannot prepare internal mirrorlist: No URLs in mirrorlist
|
Ubuntu 网络安全 开发工具
Ubuntu E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? 错误
Ubuntu E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? 错误
654 0
|
Linux Perl
Failed to download metadata for repo 'epel'
Failed to download metadata for repo 'epel'
980 0
Failed to download metadata for repo 'epel'