第6章 Azure への RHEL AI のインストール
Azure に Red Hat Enterprise Linux AI をインストールしてデプロイする方法は複数あります。
- RHEL AI は、Azure Marketplace で購入できます。
- RHEL AI ダウンロードページ から RHEL AI VHD をダウンロードし、Azure イメージに変換できます。
VHD を使用して Azure に Red Hat Enterprise Linux AI をインストールしてデプロイするには、まず RHEL AI イメージを Azure イメージに変換する必要があります。その後、Azure イメージを使用してインスタンスを起動し、Azure マシンに RHEL AI をデプロイできます。
6.1. RHEL AI イメージの Azure イメージへの変換 リンクのコピーリンクがクリップボードにコピーされました!
Azure で起動可能なイメージを作成するには、Azure アカウントを設定し、Azure ストレージコンテナーを作成し、RHEL AI VHD イメージを使用して Azure イメージを作成する必要があります。
前提条件
- 特定のマシンに Azure CLI をインストールしている。Azure CLI のインストールの詳細は、Linux に Azure CLI をインストールする を参照してください。
- 特定のマシンに AzCopy をインストールしている。AzCopy のインストールの詳細は、Linux に AzCopy をインストールする を参照してください。
手順
次のコマンドを実行して、Azure にログインします。
$ az loginログインの出力例
$ az login A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with `az login --use-device-code`. [ { "cloudName": "AzureCloud", "homeTenantId": "c7b976df-89ce-42ec-b3b2-a6b35fd9c0be", "id": "79d7df51-39ec-48b9-a15e-dcf59043c84e", "isDefault": true, "managedByTenants": [], "name": "Team Name", "state": "Enabled", "tenantId": "0a873aea-428f-47bd-9120-73ce0c5cc1da", "user": { "name": "user@example.com", "type": "user" } } ]次のコマンドを使用して、
azcopyツールでログインします。$ keyctl new_session $ azcopy loginAzure イメージを作成する前に、さまざまな Azure 設定をセットアップし、Azure Storage Container を作成する必要があります。
次のコマンドを使用して、インスタンスのロケーションを定義する環境変数を作成します。
$ az_location=eastusリソースグループを作成し、その名前を
az_resource_groupという名前の環境変数に保存します。次の例では、eastusのロケーションにDefaultという名前のリソースグループを作成します。(既存のリソースグループを使用する場合は、この手順を省略できます)。$ az_resource_group=Default $ az group create --name ${az_resource_group} --location ${az_location}次のコマンドを実行して、Azure ストレージアカウントを作成し、
az_storage_accountという名前の環境変数に名前を保存します。$ az_storage_account=THE_NAME_OF_YOUR_STORAGE_ACCOUNT$ az storage account create \ --name ${az_storage_account} \ --resource-group ${az_resource_group} \ --location ${az_location} \ --sku Standard_LRS次のコマンドを使用して、環境変数
az_storage_containerという名前の Azure Storage Container を作成します。$ az_storage_container=NAME_OF_MY_BUCKET $ az storage container create \ --name ${az_storage_container} \ --account-name ${az_storage_account} \ --public-access off次のコマンドを実行すると、Azure アカウントリストからサブスクリプション ID を取得できます。
$ az account list --output tableサブスクリプション ID を使用して `az_subscription_id` という名前の変数を作成します。
$ az_subscription_id=46c08fb3-83c5-4b59-8372-bf9caf15a681ユーザーにストレージコンテナーへの
azcopy書き込み権限を付与します。この例では、ユーザーuser@example.comに権限を付与します。$ az role assignment create \ --assignee user@example.com \ --role "Storage Blob Data Contributor" \ --scope /subscriptions/${az_subscription_id}/resourceGroups/${az_resource_group}/providers/Microsoft.Storage/storageAccounts/${az_storage_account}/blobServices/default/containers/${az_storage_container}
- Azure ストレージコンテナーがセットアップされました。Red Hat Enterprise Linux AI ダウンロードページ から Azure VHD イメージをダウンロードする必要があります。
次のコマンドで
vhd.gzファイルを展開します。$ gunzip <downloaded-azure-gz-image>RHEL AI Azure イメージとして使用する名前を設定します。
$ image_name=rhel-ai-1.5次のコマンドを実行して、VHD ファイルを Azure Storage Container にアップロードします。
$ az_vhd_url="https://${az_storage_account}.blob.core.windows.net/${az_storage_container}/$(basename ${vhd_file})" $ azcopy copy "$vhd_file" "$az_vhd_url"次のコマンドを使用して、アップロードしたばかりの VHD ファイルから Azure イメージを作成します。
$ az image create --resource-group $az_resource_group \ --name "$image_name" \ --source "${az_vhd_url}" \ --location ${az_location} \ --os-type Linux \ --hyper-v-generation V2