赞
踩
/etc/apt/truste
和apt update | upgrade; apt-key
相关的配置文件都在目录/etc/apt
下,共有以下内容:apt.conf.d preferences.d sources.list.distUpgrade trusted.gpg~
auth.conf.d sources.list sources.list.save trusted.gpg.d
keyrings sources.list.d trusted.gpg
xxx.d
,keyrings
是目录
sources.list
:(对标 系统级别)记录你使用的更新源,对应选择ubuntu服务器的设置。每设置一次都会更新这个文件
sources.list.d
:(对标 用户级别)对应各类用户安装的软件的用于更新的配置文件
关于apt-key的几个目录:trusted.gpg.d
(存储.gpg
key文件),trusted.gpg
(文件,过时了),keyrings
(我22.04目前没用到)d.gpg)
关于第三方库的key
参考资料【两种方法加其他有用信息,第一种方法如下,没成功,而且我的系统上显示采用的是第二种方式,没有用到keyrings目录】资料详细全面
总体步骤:Move all keys from /etc/apt/trusted.gpg/
to /etc/apt/keyrings
and specify the path to the key for each third-party repository.
具体实现步骤:和apt update | upgrade; apt-key
相关的配置文件都在目录/etc/apt
下,共有以下内容:
apt.conf.d preferences.d sources.list.distUpgrade trusted.gpg~
auth.conf.d sources.list sources.list.save trusted.gpg.d
keyrings sources.list.d trusted.gpg
xxx.d
,keyrings
是目录
sources.list
:(对标 系统级别)记录你使用的更新源,对应选择ubuntu服务器的设置。每设置一次都会更新这个文件
sources.list.d
:(对标 用户级别)对应各类用户安装的软件的用于更新的配置文件
关于apt-key的几个目录:trusted.gpg.d
(存储.gpg
key文件),trusted.gpg
(文件,过时了),keyrings
(我22.04目前没用到)
第一步:输出所有apt key
sudo apt-key list
可以发现,一般存储在这几个位置
/etc/apt/trusted.gpg
/etc/apt/trusted.gpg.d/xxx.gpg
而/etc/apt/trusted.gpg
应该是过时被弃用的
第二步:比对/etc/apt/trusted.gpg.d/xxx.gpg
的key identifier
(在pub开头的下一行,使用最后八个位置的字符就行),将在/etc/apt/trusted.gpg
中重复出现的删除
sudo apt-key del D38B4796
第三步:Move all keys from /etc/apt/trusted.gpg/
to /etc/apt/keyrings
sudo apt-key export DEB49217 | sudo gpg --dearmour -o /etc/apt/keyrings/teamviewer.gpg
第四步:在/etc/apt/sources.list.d/xxx.list
文件中指定gpg和http
deb [signed-by=/etc/apt/keyrings/mysql.gpg] https://…
这步我没成功,不懂设置
通过查看目录发现,当前系统默认使用这种方式
显示所有key:
sudo apt-key list
导出到trusted.gpg.d
目录
sudo apt-key export 3B4FE6ACC0B21F32 | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/ubuntu_archive_pbc.gpg
删除停用的:
sudo apt-key del 3A79BD29
Err:1 http://mirrors.aliyun.com/ubuntu bionic InRelease
The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32原因是被我主动删除了
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
3B4FE6ACC0B21F32是缺少的密钥,缺少什么就下什么
默认添加到/etc/apt/trusted.gpg
这里,但这会引发前面的warning。
apt-key
【过时了,但是用】
Warning: apt-key is deprecated. Manage keyring files in [trusted.gpg.d] instead (see apt-key(8)).
man apt-key:
APT-KEY(8) APT APT-KEY(8) NAME apt-key - Deprecated APT key management utility SYNOPSIS apt-key [--keyring filename] {add filename | del keyid | export keyid | exportall | list | finger | adv | update | net-update | {-v | --version} | {-h | --help}} DESCRIPTION apt-key is used to manage the list of keys used by apt to authenticate packages. Packages which have been authenticated using these keys will be considered trusted. Use of apt-key is deprecated, except for the use of apt-key del in maintainer scripts to remove existing keys from the main keyring. If such usage of apt-key is desired the additional installation of the GNU但 Privacy Guard suite (packaged in gnupg) is required. apt-key(8) will last be available in Debian 11 and Ubuntu 22.04.
和apt update | upgrade; apt-key
相关的配置文件都在目录/etc/apt
下,共有以下内容:
apt.conf.d preferences.d sources.list.distUpgrade trusted.gpg~
auth.conf.d sources.list sources.list.save trusted.gpg.d
keyrings sources.list.d trusted.gpg
xxx.d
,keyrings
是目录
sources.list
:(对标 系统级别)记录你使用的更新源,对应选择ubuntu服务器的设置。每设置一次都会更新这个文件
sources.list.d
:(对标 用户级别)对应各类用户安装的软件的用于更新的配置文件
关于apt-key的几个目录:trusted.gpg.d
(存储.gpg
key文件),trusted.gpg
(文件,过时了),keyrings
(我22.04目前没用到)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。