注册 Ubuntu 客户端

本节包含有关注册运行 Ubuntu 操作系统的客户端的信息。

  • 软件包和元数据由 Ubuntu 而不是 SUSE 提供。

  • 有关支持的产品,请参见版本说明和 支持的 Ubuntu 功能 中的支持表格。

SUSE Multi-Linux Manager 支持使用 Salt 的 Ubuntu 22.04 LTS 和 24.04 LTS 客户端。

Bootstrapping is supported for starting Ubuntu clients and performing initial state runs such as setting repositories and performing profile updates. However, the root user on Ubuntu is disabled by default, so to use bootstrapping, you require an existing user with sudo privileges for Python.

Canonical 不为 SUSE Multi-Linux Manager 背书,也不为其提供支持。

1. 添加软件通道

将 Ubuntu 客户端注册到您的 SUSE Multi-Linux Manager 服务器之前,您需要添加所需的软件通道,并同步这些通道。

In the following section, descriptions often default to the x86_64 architecture. Replace it with other architectures if appropriate.

此过程所需的产品包括:

Table 1. Ubuntu 产品 - WebUI
操作系统版本 产品名称

Ubuntu 24.04

Ubuntu 24.04

Ubuntu 22.04

Ubuntu 22.04

过程:添加软件通道
  1. 在 SUSE Multi-Linux Manager Web UI 中,导航到管理  安装向导  产品

  2. Locate the appropriate products for your client operating system and architecture using the search bar, and check the appropriate product. This will automatically check all mandatory channels. Also all recommended channels are checked as long as the include recommended toggle is turned on. Click the arrow to see the complete list of related products, and ensure that any extra products you require are checked.

  3. 单击 添加产品 并等待产品完成同步。

或者,您也可以在命令提示符处添加通道。此过程所需的通道包括:

Table 2. Ubuntu 通道 - CLI
操作系统版本 基础通道

Ubuntu 24.04

ubuntu-2404-amd64-main-amd64

Ubuntu 22.04

ubuntu-2204-amd64-main-amd64

过程:通过命令行添加软件通道
  1. 在 SUSE Multi-Linux Manager 容器主机的命令提示符处,以 root 身份命令添加相应的通道:

    mgrctl exec -- mgr-sync add channel <channel_label_1>
    mgrctl exec -- mgr-sync add channel <channel_label_2>
    mgrctl exec -- mgr-sync add channel <channel_label_n>
  2. 系统会自动启动同步。如果您要手动同步通道,请使用以下命令:

    mgrctl exec -- mgr-sync sync --with-children <channel_name>
  3. 确保同步已完成,然后再继续操作。

2. 镜像 Ubuntu ESM 软件包

Canonical 为 Ubuntu Pro 用户和客户提供 扩展安全维护 (ESM) 软件包。这些软件包为多个操作系统组件和选定的应用程序提供更长的维护期(10 至 12 年)。

如果您从已注册到 Ubuntu Pro 的系统中提取了所需的 GPG 密钥和您的个人持有者令牌,则这些储存库还可以在 SUSE Multi-Linux Manager 中同步。

2.1. 提取 GPG 密钥和持有者令牌

将 Ubuntu 主机注册到 Ubuntu Pro。您可以在 Ubuntu Pro 仪表板中找到自己的个人注册令牌。为此您需要创建一个 Ubuntu One 帐户

sudo apt-get install ubuntu-advantage-tools
sudo pro attach <个人令牌>

注册后,可以在 /etc/apt/auth.conf.d/90ubuntu-advantage 文件中找到持有者令牌:

machine esm.ubuntu.com/apps/ubuntu/ login bearer password <令牌>  # ubuntu-pro-client
machine esm.ubuntu.com/infra/ubuntu/ login bearer password <令牌>  # ubuntu-pro-client

将为每个储存库使用一个专用的持有者令牌。

在 SUSE Multi-Linux Manager 中配置以下储存库:

2.2. 配置 Ubuntu ESM 储存库

使用以下 URL 创建储存库:

Table 3. Ubuntu ESM 储存库
URL 说明

https://bearer:<token>@esm.ubuntu.com/infra/ubuntu/dists/<release>-infra-updates/main/binary-<arch>/

操作系统功能更新

https://bearer:<token>@esm.ubuntu.com/infra/ubuntu/dists/<release>-infra-security/main/binary-<arch>/

操作系统安全更新

https://bearer:<token>@esm.ubuntu.com/apps/ubuntu/dists/<release>-apps-updates/main/binary-<arch>/

应用程序功能更新

https://bearer:<token>@esm.ubuntu.com/apps/ubuntu/dists/<release>-apps-security/main/binary-<arch>/

应用程序安全更新

请将 <token> 替换为您的个人持有者令牌。此外,必须将 archrelease 替换为以下值之一:

Table 4. Ubuntu ESM 体系结构和版本
体系结构 版本

amd64arm64armelarmhfi386powerpcppc64els390x

bionicfocaljammynobletrustyxenial

要让 SUSE Multi-Linux Manager 同步储存库,必须导入相应的 GPG 密钥(ubuntu-advantage-esm-infra-trusty.gpgubuntu-advantage-esm-apps.gpg)。在已注册到 Ubuntu Pro 的系统上的 /etc/apt/trusted.gpg.d 中可以找到这些密钥。将这些文件复制到 SUSE Multi-Linux Manager 系统,并如下所示将其导入:

mgradm gpg add /path/to/gpg.key

在已同步的 Ubuntu 父通道下创建相应的子通道。之后,便可以同步储存库了。

此处所述的过程可用于规避订阅限制 - 但是,这样会违反服务条款并可能导致法律后果。订阅数量必须始终足以涵盖所用的系统数量。

3. 检查同步状态

过程:通过 Web UI 检查同步进度
  1. In the SUSE Multi-Linux Manager Web UI, navigate to Admin  Setup Wizard and select the Products tab. This dialog displays a completion bar for each product when they are being synchronized.

  2. Alternatively, you can navigate to Software  Manage  Channels, then click the channel associated to the repository. Navigate to the Repositories tab, then click Sync and check Sync Status.

过程:通过命令行检查同步进度
  1. 要在跟踪日志前列出可用日志,请在容器主机上运行以下命令:

    mgrctl exec ls /var/log/rhn/reposync/
  2. 在 SUSE Multi-Linux Manager 容器主机的命令提示符处,以 root 身份检查通道日志文件的同步:

    mgrctl exec -ti -- tail -f /var/log/rhn/reposync/<channel-label>.log
  3. 每个子通道在同步过程中会生成自身的日志。您需要检查所有基础通道和子通道日志文件,以确保同步完成。

Ubuntu 通道可能会非常大。同步所需的时间可能会长达数小时。

4. 管理 GPG 密钥

安装软件包之前,客户端会使用 GPG 密钥检查这些软件包的真实性。只有可信软件才能安装在客户端上。

信任 GPG 密钥对于客户端的安全非常重要。由管理员来决定需要哪些密钥,可以信任哪些密钥。这是因为如果不信任 GPG 密钥,便无法使用软件通道,是否将通道指派给客户端取决于是否信任密钥。

有关 GPG 密钥的详细信息,请参见 GPG 密钥

5. Root 访问权限

默认会为 Ubuntu 上的 root 用户禁用 SSH 访问权限。

To be able to onboard using a regular user, you need to edit the sudoers file.

This issue happens with self-installed versions of Ubuntu. If the default user has been granted administrative privileges during installation time, a password is required to perform privilege escalation using sudo. With cloud instances this does not happen because cloud-init automatically creates a file under /etc/sudoers.d and grants privilege escalation through sudo without the need for a password.

5.1. 授予 Root 用户访问权限

过程:授予 Root 用户访问权限
  1. On the client, edit the sudoers file:

    sudo visudo

    Grant sudo access to the user by adding this line at the end of the sudoers file. Replace <user> with the name of the user that is bootstrapping the client in the Web UI:

    <user>  ALL=NOPASSWD: /usr/bin/python, /usr/bin/python2, /usr/bin/python3, /var/tmp/venv-salt-minion/bin/python

This procedure grants root access without requiring a password, which is required for registering the client. When the client is successfully installed it runs with root privileges, so the access is no longer required. We recommend that you remove the line from the sudoers file after the client has been successfully installed.

5.2. 通过 SSH 以安装期间创建的用户身份引导

要通过 SSH 引导 Ubuntu 客户端,您必须将安装期间创建的用户添加到 sudo 组,然后从客户端运行引导脚本。

过程:将安装期间创建的用户添加到 sudo 组并通过 SSH 引导
  1. On the client, as root, run from the command line (replace <username> with the name of the install-created user):

    sudo usermod -aG sudo <username>
  2. Bootstrap the client system from its command line (replace <SERVER_FQDN> with the fully qualified domain name of the SUSE Multi-Linux Manager Server):

    sudo su -
    curl -Sks https://<SERVER_FQDN>/pub/bootstrap/bootstrap-script.sh | /bin/bash

Ubuntu can only be bootstrapped using the corresponding Ubuntu bootstrap script run from the client system’s command line after issuing sudo su - as above. It cannot be bootstrapped via the SUSE Multi-Linux Manager Web UI due to the fact that the root user is disabled on Ubuntu by default, and that the Web UI does not permit for privilege escalation of the Ubuntu install-created user.

6. 注册客户端

要注册您的客户端,需要有引导储存库。系统默认会自动创建引导储存库,并且每天会为所有同步的产品重新生成该储存库。您可以在容器主机的命令提示符处手动创建引导储存库:

mgrctl exec -ti mgr-create-bootstrap-repo

有关注册客户端的详细信息,请参见 客户端注册