1.更新apt-get索引
sudo apt-get update
2.更新过程中出现如下错误:
W: Failed to fetch.......
3.在/etc/resolv.conf,加上dns (或者换成国内镜像源)
nameserver 202.96.174.133
nameserver 202.96.128.68
nameserver 8.8.8.8
4.再次更新,如果还有错误,报如下错误
W: GPG error: http://repo.mysql.com jessie InRelease: The following signatures were invalid: KEYEXPIRED 1487236823 KEYEXPIRED 1487236823 KEYEXPIRED 1487236823
5.解决办法如下:
先查看执行命令:apt-key list
---------------------------------------------
pub 4096R/89DF5277 2010-07-11
uid Guillaume Plessis <gui@dotdeb.org>
sub 4096R/3D624A3B 2010-07-11
sub 4096R/A2098A6E 2010-07-11
pub 1024D/5072E1F5 2003-02-03 [expired: 2017-02-16]
uid MySQL Release Engineering <mysql-build@oss.oracle.com>
---------------------------------------------
删除mysql 的repository GPG key,删除命令如下:
sudo apt-key del 5072E1F5
---------------------------------------------
删除完了之后,检查还有没有那个mysql的key
没有了,执行命令:apt-key adv --keyserver pgp.mit.edu --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
如下输出
--------------------------------------------------
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.z5SEIWWrbt --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-security-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg --keyring /etc/apt/trusted.gpg.d/php.gpg --keyserver pgp.mit.edu --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
gpg: requesting key 5072E1F5 from hkp server pgp.mit.edu
gpg: key 5072E1F5: "MySQL Release Engineering <mysql-build@oss.oracle.com>" 62 new signatures
gpg: Total number processed: 1
gpg: new signatures: 62
--------------------------------------------------
完成后,再执行apt-get update
类似解决方法:转载于
有错误:
W: GPG error: http://ppa.launchpad.net lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A1715D88E1DF1F24
Google 之,在这篇文档里有提到解决方案:
http://muzso.hu/2007/05/25/how-to-fix-no_pubkey-errors-in-apt-get-update-operations
具体的解决方法步骤是(注意下面的KEY 是根据每次报错而不同的,可能需要用实际报错的KEY替换命令中的KEY值):
$ sudo gpg --keyserver keyserver.ubuntu.com --recv A1715D88E1DF1F24
$ sudo gpg --export --armor A1715D88E1DF1F24 | sudo apt-key add -
注:上面第二个命令中的第二个sudo,因为sudo不能跨越Pipe,所以第二个命令也需要使用sudo