5.2. 使用 CLI 在 Google Cloud Platform 上部署实例


您可以从 Google Cloud Platform web 控制台或 CLI 使用新的 RHEL AI Google Cloud Platform 镜像启动实例。您可以使用您要启动实例的部署方法。以下流程演示了如何使用 CLI 启动带有自定义 Google Cloud Platform 镜像的 Google Cloud Platform 实例

如果您选择将 CLI 用作部署选项,您必须创建几个配置,如"先决条件"所示。

先决条件

  • 您创建了 RHEL AI Google Cloud Platform 镜像。如需更多信息,请参阅"将 RHEL AI 镜像转换为 Google Cloud Platform 镜像"。
  • 在特定机器上安装 Google Cloud Platform CLI,请参阅在 Linux 上安装 Google Cloud Platform CLI

流程

  1. 运行以下命令登录到 Google Cloud Platform 帐户:

    $ gcloud auth login
    Copy to Clipboard Toggle word wrap
  2. 在 CLI 上启动 Google Cloud Platform 实例前,您需要为您的实例创建多个配置变量。
  3. 您需要选择要用于部署的实例配置集。运行以下命令列出所需区域中的所有配置集:

    $ gcloud compute machine-types list --zones=<zone>
    Copy to Clipboard Toggle word wrap

    记录您首选的机器类型,您将需要它用于您的实例部署。

  4. 现在,您可以开始创建 Google Cloud Platform 实例。在创建实例时填充环境变量。

    name=my-rhelai-instance
    zone=us-central1-a
    machine_type=a3-highgpu-8g
    accelerator="type=nvidia-h100-80gb,count=8"
    image=my-custom-rhelai-image
    disk_size=1024
    subnet=default
    Copy to Clipboard Toggle word wrap
  5. 配置要使用的区域。

    $ gcloud config set compute/zone $zone
    Copy to Clipboard Toggle word wrap
  6. 现在,您可以运行以下命令来启动实例:

    $ gcloud compute instances create \
        ${name} \
        --machine-type ${machine_type} \
        --image $image \
        --zone $zone \
        --subnet $subnet \
        --boot-disk-size ${disk_size} \
        --boot-disk-device-name ${name} \
        --accelerator=$accelerator
    Copy to Clipboard Toggle word wrap

验证

  • 要验证您的 Red Hat Enterprise Linux AI 工具是否已正确安装,请运行 ilab 命令:

    $ ilab
    Copy to Clipboard Toggle word wrap

    输出示例

    $ ilab
    Usage: ilab [OPTIONS] COMMAND [ARGS]...
    
      CLI for interacting with InstructLab.
    
      If this is your first time running ilab, it's best to start with `ilab
      config init` to create the environment.
    
    Options:
      --config PATH  Path to a configuration file.  [default:
                     /home/<user>/.config/instructlab/config.yaml]
      -v, --verbose  Enable debug logging (repeat for even more verbosity)
      --version      Show the version and exit.
      --help         Show this message and exit.
    
    Commands:
      config    Command Group for Interacting with the Config of InstructLab.
      data      Command Group for Interacting with the Data generated by...
      model     Command Group for Interacting with the Models in InstructLab.
      system    Command group for all system-related command calls
      taxonomy  Command Group for Interacting with the Taxonomy of InstructLab.
    
    Aliases:
      chat      model chat
      generate  data generate
      serve     model serve
      train     model train
    Copy to Clipboard Toggle word wrap

更新 Red Hat Enterprise Linux AI

要更新到 RHEL AI 的最新 z-stream 版本,请按照 更新 Red Hat Enterprise Linux AI 文档中的步骤 操作。

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat