当前位置: 代码网 > it编程>游戏开发>ar > 解决CentOS7.6 yum报错GPG密钥不匹配:GPG Keys are configured as:https://mirrors.aliyun.com/centos/...问题

解决CentOS7.6 yum报错GPG密钥不匹配:GPG Keys are configured as:https://mirrors.aliyun.com/centos/...问题

2025年03月11日 ar 我要评论
一、报错1.报错内容执行 yum install -y devtoolset-8-gcc* 报错[root@hcss-ecs-a901 make-4.3] yum install -y devtool

一、报错

1.报错内容

执行 yum install -y devtoolset-8-gcc* 报错

[root@hcss-ecs-a901 make-4.3] yum install -y devtoolset-8-gcc*

省略...
transaction summary
======================================================================================================
install  5 packages (+17 dependent packages)

total size: 67 m
installed size: 194 m
downloading packages:
warning: /var/cache/yum/x86_64/7/centos-sclo-rh/packages/devtoolset-8-gcc-gdb-plugin-8.3.1-3.2.el7.x86_64.rpm: header v4 rsa/sha1 signature, key id f2ee9d55: nokey
retrieving key from https://mirrors.aliyun.com/centos/rpm-gpg-key-centos-7


the gpg keys listed for the "centos-7 - sclo rh" repository are already installed but they are not correct for this package.
check that the correct key urls are configured for this repository.


 failing package is: devtoolset-8-gcc-gdb-plugin-8.3.1-3.2.el7.x86_64
 gpg keys are configured as: https://mirrors.aliyun.com/centos/rpm-gpg-key-centos-7

2.原因

gpg密钥不匹配 或者 密钥缺失。

(一般来说,都是 .repo 文件的 gpgkey 设置错误导致的)

3.什么是 gpg 密钥?(ai 解释)

gpg(gnu privacy guard)密钥用于验证软件包的完整性和来源。

具体来说,它可以确保软件包在传输过程中没有被篡改,并且确实是由合法的发布者创建的。

gpg 密钥分为公钥和私钥两部分:

  • 公钥:用于验证签名,通常发布给用户和系统。
  • 私钥:用于对软件包进行签名,只有发布者拥有。

在使用 yum 安装软件包时,系统会使用 gpg 公钥来验证软件包的签名,以确保软件包的安全性。

二、解决

1.问问gpt

  • gpt的意思是,我可能没有在 .repo 文件中设置正确的路径。
  • 这是真的。
  • 因为,我之前给这个文件设置的路径是 阿里云镜像下 centos-7 相关的 gpgkey

2.改进版本的解决方案

  • 咱不单纯听 gpt 的,将 gpgkey 完全换成另一个。
  • 小孩子才做选择。
  • 我们 两个都保留!

2.1 运行命令:

vi /etc/yum.repos.d/centos-sclo-scl-rh.repo

2.2 替换文件内容如下(请别直接抄,把 gpgkey 的 url 换成你需要的 url)

  • 同时保留阿里云 和 centos 官方的 gpgkey,我的文件内容是这样的,请注意观察:
  • 不同的 gpgkey,使用 “,” 分隔开
  • 改动了内容后,:wq保存离开。
# centos-sclo-rh.repo
#
# please see http://wiki.centos.org/specialinterestgroup/sclo for more
# information

[centos-sclo-rh]
name=centos-$releasever - sclo rh
baseurl=https://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/rh/
gpgcheck=1
enabled=1
gpgkey=https://mirrors.aliyun.com/centos/rpm-gpg-key-centos-7,https://www.centos.org/keys/rpm-gpg-key-centos-sig-sclo

2.3 引入 gpgkey

  • 引入的gpgkey,来源于上面的 url,你设置了几个,就引入几个
rpm --import https://mirrors.aliyun.com/centos/rpm-gpg-key-centos-7
rpm --import https://www.centos.org/keys/rpm-gpg-key-centos-sig-sclo

2.4 重新安装(我装我的gcc,你装你的软件去)

yum install -y devtoolset-8-gcc*

三、解决

gcc安装成功了

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持代码网。

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com