由于CentOS Linux 7及之前版本还有CentOS Stream 8很快都要停更了,所以将服务器更新到CentOS Stream 9,但是装完却报“Errors during downloading metadata for repository ‘baseos’”,具体如下。
[root@xubingtao ~]# yum -y update
CentOS Stream 9 - BaseOS 217 kB/s | 39 kB 00:00
Errors during downloading metadata for repository 'baseos':
- Status code: 404 for http://mirrors.bfsu.edu.cn/centos-stream/9-stream/BaseOS/x86_64/os/repodata/88c6d9f793a3657d6a31a13e38c19f4240f1ad6a69c78574e74c94d520f5e862-filelists.xml.gz (IP: 39.155.141.16)
- Status code: 404 for http://mirrors.bfsu.edu.cn/centos-stream/9-stream/BaseOS/x86_64/os/repodata/7fa16b05e1c36124e62401bc39d112da9d7e19e27ed67a5f4e6151734a61da78-primary.xml.gz (IP: 39.155.141.16)
Error: Failed to download metadata for repo 'baseos': Yum repo downloading error: Downloading error(s): repodata/7fa16b05e1c36124e62401bc39d112da9d7e19e27ed67a5f4e6151734a61da78-primary.xml.gz - Cannot download, all mirrors were already tried without success; repodata/88c6d9f793a3657d6a31a13e38c19f4240f1ad6a69c78574e74c94d520f5e862-filelists.xml.gz - Cannot download, all mirrors were already tried without success
明显这是yum源出问题,只需要修改一下yum源即可,这里用清华的yum源。
先备份一下centos.repo文件。
mv /etc/yum.repos.d/centos.repo /etc/yum.repos.d/centos.repo.bak
然后修改centos.repo文件。
vim centos.repo
这里直接新建一个centos.repo文件然后填入以下清华的yum源配置信息。
[BaseOS]
name=CentOS Stream $releasever - BaseOS
#mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=BaseOS&infra=$infra
baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos-stream/9-stream/BaseOS/x86_64/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[Appstream]
name=CentOS Stream $releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=AppStream&infra=$infra
baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos-stream/9-stream/AppStream/x86_64/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
清理一下缓存。
yum clean all
重新生成yum缓存文件。
yum makecache
然后就可以正常使用CentOS Stream 9了,先更新yum包,-y表示自动确认,-q表示静默安装。
yum -y update
历史上的今天:
- 2022: 微信开放能力之获取小程序码(0)
展开阅读全文
上一篇: 解决ssh远程连接Linux服务器报“WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!”
下一篇:搭LNMP环境报“[error] 22#22: *7 connect() failed (113: No route to host) while connecting to upstream”