yum更新报错Check that the correct key URLs are configured for this repository

软件开发商在释出RPM文件时,会在其中添加数字签名,并释出用于验证数字签名的公钥。使用rpm安装软件时rpm会首先根据系统中已有的公钥去验证RPM文件的数字签名。GPG keys就是公钥。

问题:yum install 出错

1
2
3
4
5
6
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID 4520afa9: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt

The GPG keys listed for the "CentOS / Red Hat Enterprise Linux 6 - atomicrocketturtle.com" repository are already installed but they are not correct for this package.
Check that the correct key URLs are configured for this repository.

这是因为系统中没有能验证该 RPM 数字签名的公钥,安装现有的GPG公钥,在 /etc/pki/rpm-gpg/ 下,可以执行:
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
或者
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
直接把所有的都安装。

还是不行的话,就通过参数指定不检查数字签名:
sudo yum -y install * --nogpgcheck