Almalinux Cannot download repomd.xml

近期捯饬我的VPS过程中,执行yum update语句和安装一些软件的时候会报错,报错的内容如下:

[root@123]# yum update
go-repo - CentOS                                                               1.2 kB/s | 219  B     00:00
Errors during downloading metadata for repository 'go-repo':
  - Status code: 404 for https://mirror.go-repo.io/centos/8/x86_64/repodata/repomd.xml (IP: 104.21.70.162)
Error: Failed to download metadata for repo 'go-repo': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@123]#

随即就去网上找原因,在github中找到大致的解决办法,想了解的可以通过连接访问一下,但是按照流程并不能解决,我的系统版本为:AlmaLinux release 8.8 (Sapphire Caracal)

[root@123]# cat /etc/centos-release
AlmaLinux release 8.8 (Sapphire Caracal)

根据提示报错:Failed to download metadata for repo 'go-repo': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

可以看到报错是无法下载某些配置文件,按照查到的资料来看,给出的解决办法为:

修改repo文件,添加以下内容
/etc/yum.repos.d/CentOS-AppStream.repo
baseurl=https://repo.almalinux.org/almalinux/$releasever/AppStream/$basearch/os/
修改repo文件,添加以下内容
/etc/yum.repos.d/CentOS-Base.repo
baseurl=https://repo.almalinux.org/almalinux/$releasever/BaseOS/$basearch/os/

经过尝试,我的系统版本/etc/yum.repos.d/路径下并没有这两个文件,思考半天,就从报错入手,直接修改/etc/yum.repos.d/go-repo.repo文件,具体如下,我未更改原本文件中的baseurl连接,直接在源文件的基础上进行新增。

注:为了避免出错,建议提前备份/etc/yum.repos.d/go-repo.repo

[go-repo]
name=go-repo - CentOS
baseurl=https://mirror.go-repo.io/centos/$releasever/$basearch/
baseurl=https://repo.almalinux.org/almalinux/$releasever/AppStream/$basearch/os/
baseurl=https://repo.almalinux.org/almalinux/$releasever/BaseOS/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=https://mirror.go-repo.io/centos/RPM-GPG-KEY-GO-REPO

更新完后,执行 yum update,成功更新,后续尝试安装软件,成功安装。

[root@123]# yum update
go-repo - CentOS                                                                29 kB/s | 3.8 kB     00:00
Dependencies resolved.
Nothing to do.
Complete!

你可能感兴趣的:(Almalinux)