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