CentOS 8 使用yum 安装软件失败

一些事项

用 yum 安装 git 失败
Failed to download metadata for repo 'appstream'

原因是 CentOS8 的源在2021年12月31日停止服务

所以替换了数据源
/etc/yum.repos.d/
同地址下备份为 /etc/yum.repos.d.backup

所以现在问题:
yum 安装 出错
Error: Failed to download metadata for repo 'AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

解决方法:

sed -i 's/$releasever/8-stream/' CentOS*repo

然后尝试 yum install git
引发了新的错误
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]

解决方法:
修改 BaseOS.repo 文件的 baseurl 参数

[baseos]
baseurl=htps://vault.centos.org/centos/$releasever/BaseOS/$basearch/os/

修改 AppStream.repo 文件的 baseurl 参数

[appstream]
baseurl=htps://vault.centos.org/centos/$releasever/AppStream/$basearch/os/

重建缓存

yum clean all
rpm --rebuilddb
yum update
yum list
yum makecache

又双抛出了新的问题
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

使用 命令 如下修复

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-*

文章参考
https://www.pudn.com/news/625d998ebe9ad24cfa84a4fc.html
https://www.pudn.com/news/6281b70b9b6e2b6d55a79008.html
http://dljz.nicethemes.cn/news/show-189146.html
http://dljz.nicethemes.cn/news/show-404986.html
https://www.miqutech.cn/955.html

posted @   Noliebe  阅读(1511)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类
点击右上角即可分享
微信分享提示