解决apt-get update缺少公钥GPG error的问题 GPG error


apt-get update 或者aptitude update出现以下错误:

W: GPG error: http://mirrors.aliyun.com/zabbix/zabbix/3.2/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 082AB56BA14FE591
W: The repository 'http://mirrors.aliyun.com/zabbix/zabbix/3.2/ubuntu xenial InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
The following signatures couldn't be verified because the public key is not available: : NO_PUBKEY B5B7720097BB3B58

解决方法: 1. 从任何一个key server获得缺失的公钥B5B7720097BB3B58。 2. 导入公钥B5B7720097BB3B58。

key="B5B7720097BB3B58"
gpg --keyserver keyserver.ubuntu.com --recv-keys $key
gpg -a --export $key | sudo apt-key add -

国内可用key server列表:

keyserver.ubuntu.com
pgp.mit.edu
subkeys.pgp.net
www.gpg-keyserver.de