Ubuntu安装Jenkins是报错:The following signatures couldn't be verified because the public key is not available: NO_PUBKEY XXXXXXXXXXX

  我使用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次会失败,看人品了。

 

posted @ 2021-02-04 18:44  没有星星的夏季  阅读(3214)  评论(0编辑  收藏  举报