删除apt-key

分两步,先检索所有已添加的app-key,然后执行删除命令。

先列出所有apt-key

执行下列命令会打印出所有添加过的apt-key

sudo apt-ket list

实例:

root@nclgclub:~$ sudo apt-key list
/etc/apt/trusted.gpg
--------------------
pub 1024D/437D05B5 2004-09-12
uid Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>
sub 2048g/79164387 2004-09-12

pub 4096R/C0B21F32 2012-05-11
uid Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>

pub 4096R/EFE21092 2012-05-11
uid Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>

pub 1024D/FBB75451 2004-12-30
uid Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>

pub 4096R/68576280 2014-06-13
uid NodeSource <gpg@nodesource.com>
sub 4096R/AA01DA2C 2014-06-13

pub 4096R/E52529D4 2018-04-18 [expires: 2023-04-17]
uid MongoDB 4.0 Release Signing Key <packaging@mongodb.com>

pub 2048R/7BD9BF62 2011-08-19 [expires: 2024-06-14]
uid nginx signing key <signing-key@nginx.com>

删除apt-key

命令为

sudo apt-key del {num}

比如现在要删除的nginx的那份,就是像下面这样,删除成功会打印OK

root@nclgclub:~$ sudo apt-key del 7BD9BF62
OK
0%