1. 程式人生 > >【Error】 the public key is not available: NO_PUBKEY 4F4EA0AAE5267A6C

【Error】 the public key is not available: NO_PUBKEY 4F4EA0AAE5267A6C

安裝了php第三方源後apt-get update遇到如下錯誤:

$ sudo apt-get update -y
Hit:1 http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid InRelease
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Hit:3 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:4 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease [23.9 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Ign:4 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease
Get:6 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Fetched 347 kB in 2s (140 kB/s)
Reading package lists... Done
W: GPG error: http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4F4EA0AAE5267A6C
W: The repository 'http://ppa.launchpad.net/ondrej/php/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.

解決辦法:

$ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C
Executing: /tmp/tmp.wyAfMZc8sV/gpg.1.sh --keyserver
keyserver.ubuntu.com
--recv-keys
4F4EA0AAE5267A6C
gpg: requesting key E5267A6C from hkp server keyserver.ubuntu.com
gpg: key E5267A6C: public key "Launchpad PPA for Ond\xc5\x99ej Sur�" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)