3 Incus 初始化与用户设置
在本章中,您必须是 root 用户或能够使用 sudo
切换到 root。此外,假定您已按照 第 2 章 中的描述设置了 ZFS 存储池。如果您选择不使用 ZFS,您可以使用不同的存储池,但需要调整初始化时的提问和回答。
Incus 初始化¶
您的服务器环境已全部设置完毕。您已准备好初始化 Incus。这是一个自动化脚本,它会提出一系列问题,以使您的 Incus 实例能够运行。
incus admin init
以下是脚本的问题和我们的答案,并附有一些解释:
Would you like to use clustering? (yes/no) [default=no]:
如果您对集群感兴趣,可以在 此处 进行一些额外的研究。
Do you want to configure a new storage pool? (yes/no) [default=yes]:
这似乎有些违反直觉。您已经创建了 ZFS 池,但在后面的问题中会清楚。接受默认值。
Name of the new storage pool [default=default]: storage
将此留作“默认”是一个选项,但使用您为 ZFS 池指定的名称会更清晰。
Name of the storage backend to use (btrfs, dir, lvm, zfs, ceph) [default=zfs]:
您应该接受默认值。
Create a new ZFS pool? (yes/no) [default=yes]: no
这里是将前面关于创建存储池的问题进行解决的地方。
Name of the existing ZFS pool or dataset: storage
Would you like to connect to a MAAS server? (yes/no) [default=no]:
Metal As A Service (MAAS) 超出了本文档的范围。
Would you like to create a new local network bridge? (yes/no) [default=yes]:
What should the new bridge be called? [default=incusbr0]:
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: none
您可以启用此选项,以便在您的 Incus 容器中使用 IPv6。
Would you like the Incus server to be available over the network? (yes/no) [default=no]: yes
这是快照服务器所必需的。
Address to bind Incus to (not including port) [default=all]:
Port to bind Incus to [default=8443]:
Trust password for new clients:
Again:
此信任密码是您连接到或从快照服务器备份的方式。将其设置为您环境中合理的密码。将此条目保存在安全的位置,例如密码管理器。
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]
Would you like a YAML "incus admin init" preseed to be printed? (yes/no) [default=no]:
设置用户权限¶
在继续之前,您必须创建您的“incusadmin”用户,并确保它拥有必要的权限。您需要“incusadmin”用户能够使用 sudo
切换到 root,并且需要它是 incus-admin
组的成员。要添加用户并确保它是这两个组的成员,请执行以下操作:
useradd -G wheel,incus-admin incusadmin
设置密码
passwd incusadmin
与之前的密码一样,将此密码保存在安全的位置。
为 root
设置 subuid
和 subgid
值¶
您必须同时设置 root 用户的 subuid
和 subgid
值(即子用户和组 ID 的范围)。该值应为
root:1000000:1000000000
为此,请编辑 /etc/subuid
文件并添加该行。完成后,您的文件将是
root:1000000:1000000000
编辑 /etc/subgid
文件并添加该行。完成后,您的文件将是
incusadmin:100000:65536
root:1000000:1000000000
在继续之前,请重启服务器。
作者:Steven Spencer
贡献者:Ezequiel Bruni, Ganna Zhyrnova