You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

执行yum update时出现SSL证书验证位置错误的解决求助

执行yum update时出现SSL证书验证位置错误的解决求助

看起来你在执行yum update时碰到了Docker CE仓库的SSL证书验证故障,这种问题大多和CA证书文件的路径、权限或者文件本身损坏有关。下面是几个实用的排查和修复方法,你可以一步步试试:

排查步骤与解决方案

  • 检查CA证书文件的存在性和权限
    首先确认系统指定的CA证书文件是否存在,执行以下命令:

    ls -l /etc/pki/tls/certs/ca-bundle.crt
    

    如果文件存在,还要确保所有用户都有读取权限,执行命令修正权限:

    chmod 644 /etc/pki/tls/certs/ca-bundle.crt
    
  • 重新生成系统CA证书 bundle
    如果证书文件已经损坏或者缺失,可以通过系统命令重新生成有效的CA证书集合:

    update-ca-trust extract
    

    这个命令会重新整理系统内的CA证书,生成正确的ca-bundle.crt文件。

  • 临时跳过SSL验证(仅作测试用)
    如果上面的方法都没见效,你可以临时禁用该仓库的SSL验证来确认是否是证书问题。编辑Docker CE的repo配置文件(通常路径是/etc/yum.repos.d/docker-ce.repo),找到[docker-ce-stable]小节,添加或修改一行:

    sslverify=0
    

    保存后再执行yum update测试。注意这个只是临时 workaround,不建议长期使用,还是要尽快修复证书问题。

  • 检查系统时间是否同步
    系统时间偏差过大也会导致SSL证书验证失败,你可以先查看当前时间:

    date
    

    如果时间不对,开启自动时间同步:

    timedatectl set-ntp true
    

你遇到的具体错误信息

[root@CJL01 ~]# sudo yum update
Docker CE Stable - x86_64                                                                                                                                     0.0  B/s |   0  B     00:00
Errors during downloading metadata for repository 'docker-ce-stable':
- Curl error (77): Problem with the SSL CA cert (path? access rights?) for https://download.docker.com/linux/centos/8/x86_64/stable/repodata/repomd.xml [error setting certificate verify locations:
CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none]
Error: Failed to download metadata for repo 'docker-ce-stable': Cannot download repomd.xml: Curl error (77): Problem with the SSL CA cert (path? access rights?) for https://download.docker.com/linux/centos/8/x86_64/stable/repodata/repomd.xml [error setting certificate verify locations:
CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none]

备注:内容来源于stack exchange,提问作者eifach_CJ

火山引擎 最新活动