You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CentOS 9 Stream中使用yum下载baseos仓库元数据失败求助

CentOS 9 Stream中使用yum下载baseos仓库元数据失败求助

看了你的问题描述,明明网络正常、能ping通mirrors.centos.org,DNS也设了8.8.8.8,但yum就是连不上443端口报错,这种情况我之前也碰到过,给你几个排查和解决的思路:

一、先排查本地防火墙/SELinux的拦截

有时候ping通只是ICMP协议放行,但HTTPS(443端口)的出站请求被防火墙或SELinux拦住了:

  • 临时关闭防火墙测试:
    systemctl stop firewalld
    
    之后再执行yum makecache看看是否正常
  • 临时关闭SELinux测试:
    setenforce 0
    
    如果解决了,再考虑调整防火墙规则或者SELinux策略,不要一直保持关闭状态

二、替换mirror源,绕过metalink的问题

有可能是metalink指向的节点出了问题,直接改用具体的CentOS源试试:

  1. 编辑baseos的repo配置文件:
    vi /etc/yum.repos.d/CentOS-Stream-BaseOS.repo
    
  2. 找到[baseos]段,注释掉metalink那一行,添加具体的baseurl:
    # metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-9-stream&arch=x86_64&protocol=https,http
    baseurl=http://mirror.centos.org/centos/9-stream/BaseOS/x86_64/os/
    
  3. 清理缓存并重新生成:
    yum clean all
    yum makecache
    

三、检查代理设置

有时候系统里残留了代理配置,导致curl无法正常连接HTTPS端口:

  • 查看当前代理环境变量:
    echo $http_proxy $https_proxy
    
  • 如果有输出代理地址,先取消设置:
    unset http_proxy https_proxy
    
    再测试yum命令

四、确认系统时间是否正确

HTTPS证书验证依赖正确的系统时间,如果时间偏差太大,会导致连接被拒绝:

  • 查看当前系统时间:
    timedatectl
    
  • 如果时间不对,开启自动时间同步:
    timedatectl set-ntp true
    

附你提供的错误信息:

Errors during downloading metadata for repository 'baseos':

  • Curl error (7): Couldn't connect to server for https://mirrors.centos.org/metalink?repo=centos-baseos-9-stream&arch=x86_64&protocol=https,http
    [Failed to connect to mirrors.centos.org port 443: Connection refused]
    Error: Failed to download metadata for repo 'baseos': Cannot prepare internal
    mirrorlist: Curl error (7): Couldn't connect to server for https://mirrors.centos.org/metalink?repo=centos-baseos-9-stream&arch=x86_64&protocol=https,http
    [Failed to connect to mirrors.centos.org port 443: Connection refused]

备注:内容来源于stack exchange,提问作者mr.bug

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.17 10:58:14