当我们使用yum安装某些工具的时候,会提示安装源失败。错误消息如下
[root@product016 ~]# yum -y install gcc automake autoconf libtool make
CentOS Linux 8 – AppStream 7.5 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)
错误:为 repo ‘appstream’ 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
在centos8里面,我们使用root用户登录后,操作如下。
跳转到/etc/yum.repos.d/文件夹下,可以看到有很多源,我们只要修改3个。
分别是CentOS-AppStream.repo和CentOS-Linux-AppStream.repo和CentOS-Linux-BaseOS.repo
[root@product016 ~]# cd /etc/yum.repos.d/
[root@product016 yum.repos.d]# ls
CentOS-AppStream.repo CentOS-Linux-Debuginfo.repo CentOS-Linux-FastTrack.repo CentOS-Linux-PowerTools.repo
CentOS-Linux-AppStream.repo CentOS-Linux-Devel.repo CentOS-Linux-HighAvailability.repo CentOS-Linux-Sources.repo
CentOS-Linux-BaseOS.repo CentOS-Linux-epel.repo CentOS-Linux-Media.repo
CentOS-Linux-ContinuousRelease.repo CentOS-Linux-Extras.repo CentOS-Linux-Plus.repo
vim /etc/yum.repos.d/CentOS-AppStream.repo 回车
然后按下i键,修改baseurl为下面的地址
https://mirrors.aliyun.com/centos/8-stream/BaseOS/x86_64/os/
然后按esc键,然后输入:wq回车
内容大概如下
[AppStream]
name=CentOS-8 – AppStream
release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
baseurl=https://mirrors.aliyun.com/centos/8-stream/BaseOS/x86_64/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/306682.html