一些事项
用 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
原创文章,作者:jamestackk,如若转载,请注明出处:https://blog.ytso.com/267859.html