yum 使用遇到报错
早期已经修改过阿里云镜像源
CentOS-8 - AppStream 7.3 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)
Error: Failed to download metadata for repo 'AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
先操作一波
# 1. 备份(已经无效了, 实际完全没有必要)
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.bak
# 2. 下载阿里源的文件
wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 3.清理缓存
yum clean all && yum makecache
报错
CentOS-8 - Base - mirrors.aliyun.com 303 B/s | 2.3 kB 00:07
Errors during downloading metadata for repository 'base':
- Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/BaseOS/x86_64/os/repodata/repomd.xml (IP: 100.100.2.148)
- Status code: 404 for https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/repodata/repomd.xml (IP: 39.96.118.196)
- Curl error (7): Couldn't connect to server for http://mirrors.aliyuncs.com/centos/8/BaseOS/x86_64/os/repodata/repomd.xml [Failed to connect to mirrors.aliyuncs.com port 80: Connection timed out]
Error: Failed to download metadata for repo 'base': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
查看了下已经没有镜像文件了, Centos8 不在维护, 镜像站中均已移除CentOS 8的源.
只能用其他源.
# 1. 备份
cd /etc/yum.repos.d/
mkdir bak
mv * bak/
# 2. 下载阿里云源的文件
wget https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo -O /etc/yum.repos.d/Centos-vault-8.5.2111.repo
wget https://mirrors.aliyun.com/repo/epel-archive-8.repo -O /etc/yum.repos.d/epel-archive-8.repo
# 3. 清除缓存
yum clean all && yum makecache
输出
0 files removed
CentOS-8.5.2111 - Base - mirrors.aliyun.com 532 kB/s | 4.6 MB 00:08
CentOS-8.5.2111 - Extras - mirrors.aliyun.com 36 kB/s | 10 kB 00:00
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com 353 kB/s | 8.4 MB 00:24
Extra Packages for Enterprise Linux 8 - x86_64 385 kB/s | 6.4 MB 00:16
Metadata cache created.
完成