安装RPM时报错Error: GPG check FAILED

Posted YoungerChina

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装RPM时报错Error: GPG check FAILED相关的知识,希望对你有一定的参考价值。

1. 问题描述

需要安装mysl及其连接器。但安装mysql-8.0.26后,在安装mysql-connector-java时报错,错误日志如下误:

[SKIPPED] mysql-connector-java-8.0.30-1.el7.noarch.rpm: Already downloaded                                                                         
MySQL Connectors Community                                                                                           27 MB/s |  27 kB     00:00    
GPG key at file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql (0x5072E1F5) is already installed
The GPG keys listed for the "MySQL Connectors Community" 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: mysql-connector-java-1:8.0.30-1.el7.noarch
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'yum clean packages'.
Error: GPG check FAILED

大致意思是:源 "MySQL Connectors Community" 的 GPG 密钥已安装,但是不适用于此软件包。请检查源的公钥 URL 是否配置正确。
 失败的软件包是:mysql-connector-java-1:8.0.30-1.el7.noarch
 GPG  密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

总结失败原因:GPG对于包的源key的验证没有通过

解决方案可以从以下两个角度:

1、重新导入源key

2、不执行key验证

2. 解决方案一

     重新导入import mysql的公钥到RPM的配置中。

# rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

    重新执行mysql-connector-java安装

# yum install mysql-connector-java -y

安装成功

3. 解决方案二

在yum install 版本后面加上 --nogpgcheck,即可绕过GPG验证成功安装。比如命令:

# yum install mysql-connector-java -y--nogpgcheck

安装完毕。

以上是关于安装RPM时报错Error: GPG check FAILED的主要内容,如果未能解决你的问题,请参考以下文章

安装RPM时报错Error: GPG check FAILED

yum安装软件时报错: Transaction check error

Linux安装rpm包时报错Header V3 DSA/SHA1 Signature, key ID 1d1e034b: NOKEY解决办法

解决 yum安装时报错 Error: Protected multilib versions: 报错

升级openssh编译时报错“configure: error: *** working libcrypto not found, check config.log”的解决办法

linux下安装yum时报错需要python(abi)=2.4请问怎么处理