RedHat7使用阿里云镜像建立元数据缓存时404解决

备份原yum源文件
使用阿里yum源
1wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
2yum clean all
3yum makecache
报错:
已加载插件:langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
http://mirrors.aliyun.com/centos/7Server/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
正在尝试其它镜像。
To address this issue please refer to the below knowledge base article

https://access.redhat.com/articles/1320623

If above article doesn’t help to resolve this issue please open a ticket with Red Hat Support.

http://mirrors.aliyuncs.com/centos/7Server/os/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - “Failed connect to mirrors.aliyuncs.com:80; 拒绝连接”
正在尝试其它镜像。
http://mirrors.cloud.aliyuncs.com/centos/7Server/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - “Could not resolve host: mirrors.cloud.aliyuncs.com; 未知的错误”
正在尝试其它镜像。
http://mirrors.aliyuncs.com/centos/7Server/os/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - “Failed connect to mirrors.aliyuncs.com:80; 拒绝连接”
正在尝试其它镜像。
^Z
[1]+ 已停止 yum makecache

解决办法:

sed -i 's/\$releasever/7/' /etc/yum.repos.d/CentOS-Base.repo

$releasever的值,这个表示当前系统的发行版本,可以通过rpm -qi centos-release命令查看

sed -i 's#$basearch#x86_64#g' /etc/yum.repos.d/CentOS-Base.repo

$basearch是我们的系统硬件架构(CPU指令集),使用命令arch得到

yum clean all
yum makecache

已加载插件:langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
base/x86_64/primary_db FAILED % [ ] 0.0 B/s | 138 kB --:–:-- ETA
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/04efe80d41ea3d94d36294f7107709d1c8f70db11e152d6ef562da344748581a-primary.sqlite.bz2: [Errno 14] curl#6 - “Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error”
正在尝试其它镜像。
(1/10): base/x86_64/group_gz | 165 kB 00:00:00
(2/10): extras/x86_64/filelists_db | 207 kB 00:00:01
(3/10): extras/x86_64/other_db | 100 kB 00:00:01
(4/10): base/x86_64/other_db | 2.6 MB 00:00:02
(5/10): updates/x86_64/other_db | 124 kB 00:00:00
(6/10): updates/x86_64/filelists_db | 1.1 MB 00:00:02
(7/10): base/x86_64/primary_db | 6.0 MB 00:00:03
base/x86_64/filelists_db FAILED
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/41232548001a78473ae0f2d4b92e1ec28f7a0593e0495056515887fe2a39b416-filelists.sqlite.bz2: [Errno 14] curl#7 - “Failed connect to mirrors.aliyuncs.com:80; Connection refused”
正在尝试其它镜像。
updates/x86_64/primary_db FAILED 7% [============================================= ] 385 kB/s | 13 MB 00:00:16 ETA
http://mirrors.aliyuncs.com/centos/7/updates/x86_64/repodata/320c8b1640e6fbb60ae572bf3c6f12cafbdd49d6e03f83578928e411720dc939-primary.sqlite.bz2: [Errno 14] curl#7 - “Failed connect to mirrors.aliyuncs.com:80; Connection refused”
正在尝试其它镜像。
extras/x86_64/primary_db FAILED 2% [================================================- ] 512 kB/s | 14 MB 00:00:10 ETA
http://mirrors.aliyuncs.com/centos/7/extras/x86_64/repodata/4e72f00067036f7cc3d1c01071a0f80f1ca5cb4fe19ee225a766e50912179ab6-primary.sqlite.bz2: [Errno 14] curl#7 - “Failed connect to mirrors.aliyuncs.com:80; Connection refused”
正在尝试其它镜像。
(8/10): updates/x86_64/primary_db | 1.1 MB 00:00:01
(9/10): extras/x86_64/primary_db | 152 kB 00:00:00
(10/10): base/x86_64/filelists_db | 7.3 MB 00:00:18
元数据缓存已建立

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值