是否可以下载 snap 并将其安装在另一台无法访问互联网的机器上?还是我始终需要控制台中的 snap store/snap 命令?
答案1
离线系统需要 snapd(snap 命令)。
离线系统需要 snap itelf。
离线系统不需要 snap store。
从https://forum.snapcraft.io/t/offline-snap-installers-and-possibility-to-update/275:
$ snap download hello-world
Fetching snap "hello-world"
Fetching assertions for "hello-world"
kyrofa@Pandora:~$ sudo snap ack hello-world_27.assert
kyrofa@Pandora:~$ sudo snap install hello-world_27.snap
hello-world 6.3 from 'canonical' installed
kyrofa@Pandora:~$ snap list
Name Version Rev Developer Notes
<snip>
hello-world 6.3 27 canonical -
离线快照的关键在于您必须手动操作 snapd 数据库以告知其有关软件包和更新的信息。这就是“snap ack”命令。
示例中的以下确认表示:嘿,数据库,我当前的工作目录中存在一个名为 hello-world27.snap 的本地包。如果下载的包在其他地方,请添加完整路径。
$ sudo snap ack hello-world_27.assert
snapd 的手册页对 ack 做了更详细的解释:
ack
Add an assertion to the system
The ack command tries to add an assertion to the system assertion data‐
base.
The assertion may also be a newer revision of a pre-existing assertion
that it will replace.
To succeed the assertion must be valid, its signature verified with a
known public key and the assertion consistent with and its prerequisite
in the database.