Cloud-init 配置文件#

本节提供有关为 Ubuntu 自动化服务器安装 创建 cloud-init 配置文件的说明。

修改配置文件#

以下文本是示例配置文件的概要。它不能直接使用,但需要按照章节中的描述进行额外修改。更多详细信息,请参阅 Ubuntu 自动化服务器安装

  1. 使用以下标头开始配置文件

    #cloud-config
    autoinstall:
      version: 1
    
  2. 定义默认用户(示例中使用 Ubuntu)、本地化和键盘布局。

    ##
    ## Set initial system and user information
    ## use mkpassword -m sha-512 <password> to create a password
    ##
      identity:
        realname: DGX Ubuntu User
        hostname: dgx-host
        password: <PASSWORD HASH>
        username: ubuntu
      locale: en_US
      keyboard:
        layout: en
        variant: us
      reporting:
        builtin:
          type: print
    
  3. 网络部分描述了网络配置,并支持固定地址、DHCP 和各种其他网络选项。网络接口的名称取决于系统。这些是各种 DGX 系统的主要管理端口。例如

    • DGX-1: enp1s0f0

    • DGX-2: enp6s0

    • DGX A100: enp226s0

    • DGX H100/H200: eno3

    ##
    ## Network Configuration
    ##
      network:
        version: 2
        ethernets:
          enp1s0f0:
            dhcp4: yes
    
  4. 将 Subiquity 安装程序更新到 edge 频道。

    refresh-installer:
      channel: edge
      update: yes
    
  5. 提供有关其他 NVIDIA 存储库的详细信息。有关更多信息,请参阅下方的 驱动器分区

    ##
    ## Enable this for using the remote repositories
    ##
      apt:
        <Repository details for the CUDA Compute and DGX Repository>
    
        conf: |
          Dpkg::Options {
            "--force-confdef";
            "--force-confold";
    
  6. 配置存储。

    下一节描述存储配置,包括交换配置和驱动器分区。通过将大小设置为 0,我们禁用交换分区。请参阅 驱动器分区

    reorder_uefi 标志告诉安装程序不要更改启动顺序,以将当前启动项 (BootCurrent) 放置在首位。

    ##
    ## Storage Configuration
    ##
      storage:
        config:
          <Partition and other configurations>
        swap:
          size: 0
        grub:
          reorder_uefi: false
    
  7. 启用 SSH 服务器。

    您还可以设置默认 SSH 密钥。

    ##
    ## SSH Server
    ##
      ssh:
        install-server: yes
        allow-pw: yes
    
  8. 提供应安装软件包的列表。

    有关更改特定 DGX 系统的软件包名称以及启用或禁用功能的说明,请参阅本文档中的注释。

    ##
    ## Packages
    ##
      packages:
    
    ##
    ## NVIDIA DGX system configurations and system tools
    ## Replace dgx-a100 for other DGX systems:
    ##  dgx1     for DGX-1
    ##  dgx2     for DGX-2
    ##  dgx-a100 for DGX A100
    ##  dgx-h100 for DGX H100
    ##
        - dgx-a100-system-configurations
        - dgx-a100-system-tools
        - dgx-a100-system-tools-extra
    
    ## Remove this if you don’t want to use cachefilesd
        - nvidia-conf-cachefilesd
    
    ## Remove this if boot drive encryption is enabled and you don’t
    ## want the passphrase dialog only visible on the serial console
        - nvidia-ipmisol
    
    ##
    ## NVIDIA CUDA driver and tools
    ## Change the driver version to the branch you want to install
    ##
        - datacenter-gpu-manager
        - libnvidia-nscq-525
        - linux-modules-nvidia-525-server-generic
        - nvidia-driver-525-server
        - nvidia-modprobe
        - nv-persistence-mode
    
    ## Uncomment these to support the NVswitch on DGX-2, DGX A100, and DGX H100
    ## Ensure that the driver version matches with the versions above
    #    - libnvidia-nscq-525
    #    - nvidia-fabricmanager-525
    
    ##
    ## Mellanox drivers and tools
    ##
        - nvidia-mlnx-config
        - nvidia-mlnx-names
        - nvidia-mlnx-ofed-misc
    
    ##
    ## NVIDIA container support
    ##
        - docker-ce
        - nv-docker-options
        - nvidia-docker2
    
    ##
    ## NVIDIA system management tools
    ##
        - nvsm
        - nvidia-motd
    
  9. 添加要在自动安装期间安装的任何其他软件包。

  10. 最后,添加要在安装结束时执行的其他命令列表。

    • 禁用无人值守升级

    • 禁用 ondemand governor 默认设置为性能模式

    • 启用 DCGM 和 OpenIBD 服务

    • 启用 nv-peer-mem

    ##
    ## Commands executed after completion of the installation
    ##
      late-commands:
        - curtin in-target --target=/target -- apt purge -y unattended-upgrades
        - curtin in-target --target=/target -- systemctl disable ondemand
        - curtin in-target --target=/target -- systemctl enable dcgm openibd
        - curtin in-target --target=/target -- update-rc.d nv_peer_mem defaults
    # DGX A100 …
        - curtin in-target -- mlnx_pxe_setup.bash
    

驱动器分区#

storage:
   config:
   - id: disk-sda
     type: disk
     ptable: gpt
     path: /dev/sda
     name: osdisk
     wipe: superblock-recursive
   - id: partition-sda1
     type: partition
     device: disk-sda
     number: 1
     size: 512M
     flag: boot
     grub_device: true
   - id: partition-sda2
     type: partition
     device: disk-sda
     number: 2
     size: 100G
   - id: format-partition-sda1
     type: format
     fstype: fat32
     label: efi
     volume: partition-sda1
   - id: format-partition-sda2
     type: format
     fstype: ext4
     label: root
     volume: partition-sda2
   - id: root-mount
     type: mount
     path: /
     device: format-partition-sda2
     options: errors=remount-ro
     passno: 1
   - id: boot-mount
     type: mount
     path: /boot/efi
     device: format-partition-sda1
     passno: 1
   - id: disk-sdb
     type: disk
     ptable: gpt
     path: /dev/sdb
     name: raid
     wipe: superblock-recursive
   - id: partition-sdb1
     type: partition
     device: disk-sdb
     number: 1
   - id: format-partition-sdb1
     type: format
     fstype: ext4
     label: raid
     volume: partition-sdb1
   - id: raid-mount
     type: mount
     path: /raid
     device: format-partition-sdb1
     passno: 2