Oracle Linux yum源错误: [Errno 14] HTTP Error 404 - Not Found($releasever变量错误)

本文详细介绍了在CentOS系统中配置阿里云镜像源过程中遇到的HTTP 404错误,并提供了有效的解决方案。通过调整$releasever变量,确保了YUM源正确指向阿里云镜像,最终实现了系统的顺利更新。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

配置阿里源:
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
报错:

http://mirrors.aliyun.com/centos/7Server/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found

解决:

在阿里源的官方网站找,发现正确的路径应该是: http://mirrors.aliyun.com/centos/7/os/x86_64/repodata/
查看阿里的源的文件CentOS-Base.repo,发现链接的定义是: http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
判断应该是在Oracle Linux中$releasever的定义有问题,没找到具体哪里设置的这个变量,
Redhat的官方文档中找到修改$releasever变量的方法:echo "7" > /etc/yum/vars/releasever

结果:

yum makecache
yum update -y
yum install epel-release -y
成功执行

回答: 您遇到的问题是在使用CentOS镜像时出现了404错误。这个错误通常是由于镜像中的某个文件或目录不存在导致的。解决这个问题的方法有几种。一种方法是更换镜像,可以使用阿里云镜像来替代原来的镜像。您可以将相应的CentOS版本的镜像文件下载到/etc/yum.repos.d目录下,具体命令如下: CentOS 5: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo CentOS 6: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo CentOS 7: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo \[2\] 另一种方法是修改CentOS-Base.repo文件中的$releasever为7,可以使用sed命令来实现,具体命令如下: sed -i 's/$releasever/7/' CentOS-Base.repo 然后清除本地缓存并重新建立缓存,具体命令如下: yum clean all yum makecache \[3\] 通过以上方法,您应该能够解决这个问题并成功下载所需的文件。 #### 引用[.reference_title] - *1* *2* *3* [Redhat7 将本地yum修改为阿里镜像,安装软件的时候“HTTP Error 404 - Not Found”的解决办法](https://blog.youkuaiyun.com/weixin_43211760/article/details/83929325)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值