第 5 章 在 Google Cloud Platform (GCP)上安装 RHEL AI
要在 Google Cloud Platform 上安装和部署 Red Hat Enterprise Linux AI,您必须首先将 RHEL AI 镜像转换为 GCP 镜像。然后,您可以使用 GCP 镜像启动实例,并在 Google Cloud Platform 机器上部署 RHEL AI。
5.1. 将 RHEL AI 镜像转换为 Google Cloud Platform 镜像。 复制链接链接已复制到粘贴板!
要在 Google Cloud Platform 中创建可引导镜像,您必须配置 Google Cloud Platform 帐户,创建 Google Cloud Storage 存储桶,并使用 RHEL AI 原始镜像创建 Google Cloud Platform 镜像。
先决条件
- 您在特定机器上安装了 Google Cloud Platform CLI。有关安装 GCP CLI 的更多信息,请参阅在 Linux 上安装 Google Cloud Platform CLI。
- 您必须位于 Red Hat Enterprise Linux 版本 9.2 - 9.4 系统中
- 您的计算机必须有额外的 100 GB 磁盘空间。
流程
使用以下命令登录到 Google Cloud Platform:
$ gcloud auth login登录输出示例。
$ gcloud auth login Your browser has been opened to visit: https://accounts.google.com/o/oauth2/auth?XXXXXXXXXXXXXXXXXXXX You are now logged in as [user@example.com]. Your current project is [your-project]. You can change this setting by running: $ gcloud config set project PROJECT_ID您需要设置一些 Google Cloud Platform 配置并在创建 GCP 镜像前创建 GCP Storage Container。
配置 Google Cloud Platform CLI 以使用您的项目。
$ gcloud_project=your-gcloud-project $ gcloud config set project $gcloud_project创建定义您要运行的区域的环境变量。
$ gcloud_region=us-central1创建 Google Cloud Platform Storage Container。
$ gcloud_bucket=name-for-your-bucket $ gsutil mb -l $gcloud_region gs://$gcloud_bucket
-
现在,您的 GCP Storage Container 已被设置,您需要从 Red Hat Enterprise Linux AI 下载页面 下载 GCP
tar.gz镜像。 使用以下命令解压
tar.gz文件:$ gunzip <downloaded-gcp-gz-image>设置您要用作 RHEL AI Google Cloud Platform 镜像的名称。
$ image_name=rhel-ai-1-2运行以下命令,将
tar.gz文件上传到 Google Cloud Platform Storage Container:$ gsutil cp rhelai_gcp.tar.gz "gs://${gcloud_bucket}/$image_name.tar.gz"使用以下命令,从您刚才上传的
tar.gz文件创建 Google Cloud Platform 镜像:$ gcloud compute images create \ "$image_name" \ --source-uri="gs://${gcloud_bucket}/$image_name.tar.gz" \ --family "rhel-ai" \ --guest-os-features=GVNIC