我使用Ubuntu16.04安裝Jenkins時,按照官網的要求,步驟如下(https://pkg.jenkins.io/debian-stable/):
# 添加Key sudo wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
# 添加包源,可以打開/etc/apt/sources.list,添加一行:deb https://pkg.jenkins.io/debian-stable binary/
# sudo vim /etc/apt/sources.list
# 或者使用下面的命令追加到包源文件
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
# 更新包源
sudo apt-get update
# 安裝jenkins
sudo apt-get install jenkins
但是在執行更新包源時,報錯了:The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FCEF32E745F2C3D5
Reading package lists... Done W: GPG error: https://pkg.jenkins.io/debian-stable binary/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FCEF32E745F2C3D5 W: The repository 'http://pkg.jenkins.io/debian-stable binary/ Release' 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.
這個是說由於沒有公鑰,無法驗證下列簽名,解決辦法是添加上面的公鑰,比如上面的信息說我的公鑰是:FCEF32E745F2C3D5
於是我就執行下面的命令:
# 最后的參數就是公鑰
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FCEF32E745F2C3D5
執行完之后,再執行 sudo apt-get update 就不會報錯了,但是可能有其它的錯,比如連接失敗等等,多試幾次就好了。
不過最后的install十次有9次會失敗,看人品了。