apt-get update遇到NO_PUBKEY

这是因为给 Ubuntu 安装软件的时候需要做验证,当然了,这个并不是必须的,也就是你的容器里也可以装没有经过认证可能不安全的源中安装需要的软件,虽然不建议,但是有时候为了快速调试,比如在公司内部的源里安装软件,可以试一下。

如果遇到 NO_PUBKEY 的问题,如下:

root@spark-sparkoperator-58f598c98b-x7vjn:/etc/apt/trusted.gpg.d# apt-get update
Get:1 http://mirrors.tencent.com/ubuntu bionic InRelease [242 kB]
Err:1 http://mirrors.tencent.com/ubuntu bionic InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32
Reading package lists... Done
W: GPG error: http://mirrors.tencent.com/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32
E: The repository 'http://mirrors.tencent.com/ubuntu bionic InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
root@spark-sparkoperator-58f598c98b-x7vjn:/etc/apt/trusted.gpg.d# apt-get install iputils-ping
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package iputils-ping

上面是我发现镜像里没有 ping 工具,所以需要装一个,但是遇到了 NO_PUBKEY 的问题,于是通过下面的命令可以成功安装,原理当然就是,没有做验证了。

apt -o Acquire::AllowInsecureRepositories=true -o Acquire::AllowDowngradeToInsecureRepositories=true update
apt -o Acquire::AllowInsecureRepositories=true -o Acquire::AllowDowngradeToInsecureRepositories=true  install iputils-ping

搞清楚原理,其实这类问题是很容易解决的,类似的如 Centos,也是一个道理。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值