Chapter 6. Installing RHEL AI on Azure There are multiple ways you can install, and deploy Red Hat Enterprise Linux AI on Azure. You can purchase RHEL AI from the Azure marketplace . You can download the RHEL AI VHD on the RHEL AI download page and convert it to an Azure image. For installing and deploying Red Hat Enterprise Linux AI on Azure using the VHD, you must first convert the RHEL AI image into an Azure image. You can then launch an instance using the Azure image and deploy RHEL AI on an Azure machine. 6.1. Converting the RHEL AI image into a Azure image To create a bootable image on Azure you must configure your Azure account, create an Azure Storage Container, and create an Azure image using the RHEL AI raw image. Prerequisites You installed the Azure CLI on your specific machine. For more information on installing the Azure CLI, see Install the Azure CLI on Linux . You installed the AzCopy on your specific machine. For more information on installing AzCopy, see Install AzCopy on Linux . Procedure Log in to Azure by running the following command: USD az login Example output of the login USD 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" } } ] Log in with the azcopy tool using the following commands: USD keyctl new_session USD azcopy login You need to set up various Azure configurations and create your Azure Storage Container before creating the Azure image. Create an environment variable defining the location of your instance with the following command: USD az_location=eastus Create a resource group and save the name in an environment variable named az_resource_group . The following example creates a resource group named Default in the location eastus . (You can omit this step if you want to use an already existing resource group). USD az_resource_group=Default USD az group create --name USD{az_resource_group} --location USD{az_location} Create an Azure storage account and save the name in an environment variable named az_storage_account by running the following commands: USD az_storage_account=THE_NAME_OF_YOUR_STORAGE_ACCOUNT USD az storage account create \ --name USD{az_storage_account} \ --resource-group USD{az_resource_group} \ --location USD{az_location} \ --sku Standard_LRS Create your Azure Storage Container named as the environment variable az_storage_container with the following commands: USD az_storage_container=NAME_OF_MY_BUCKET USD az storage container create \ --name USD{az_storage_container} \ --account-name USD{az_storage_account} \ --public-access off You can get your Subscription ID from the Azure account list by running the following command: USD az account list --output table Create a variable named ` az_subscription_id` with your Subscription ID . USD az_subscription_id=46c08fb3-83c5-4b59-8372-bf9caf15a681 Grant azcopy write permission to user into the storage container. This example grants permission to the user user@example.com . USD az role assignment create \ --assignee user@example.com \ --role "Storage Blob Data Contributor" \ --scope /subscriptions/USD{az_subscription_id}/resourceGroups/USD{az_resource_group}/providers/Microsoft.Storage/storageAccounts/USD{az_storage_account}/blobServices/default/containers/USD{az_storage_container} Now that your Azure storage container is set up, you need to download the Azure VHD image from Red Hat Enterprise Linux AI download page . Set the name you want to use as the RHEL AI Azure image. USD image_name=rhel-ai-1.3 Upload the VHD file to the Azure Storage Container by running the following command: USD az_vhd_url="https://USD{az_storage_account}.blob.core.windows.net/USD{az_storage_container}/USD(basename USD{vhd_file})" USD azcopy copy "USDvhd_file" "USDaz_vhd_url" Create an Azure image from the VHD file you just uploaded with the following command: USD az image create --resource-group USDaz_resource_group \ --name "USDimage_name" \ --source "USD{az_vhd_url}" \ --location USD{az_location} \ --os-type Linux \ --hyper-v-generation V2 6.2. Deploying your instance on Azure using the CLI You can launch an instance with your new RHEL AI Azure image from the Azure web console or the CLI. You can use whichever method of deployment you want to launch your instance. The following procedure displays how you can use the CLI to launch an Azure instance with the custom Azure image If you choose to use the CLI as a deployment option, there are several configurations you have to create, as shown in "Prerequisites". Prerequisites You created your RHEL AI Azure image. For more information, see "Converting the RHEL AI image to an Azure image". You installed the Azure CLI on your specific machine, see Install the Azure CLI on Linux . Procedure Log in to your Azure account by running the following command: USD az login You need to select the instance profile that you want to use for the deployment. List all the profiles in the desired region by running the following command: USD az vm list-sizes --location <region> --output table Make a note of your preferred instance profile, you will need it for your instance deployment. You can now start creating your Azure instance. Populate environment variables for when you create the instance. name=my-rhelai-instance az_location=eastus az_resource_group=my_resource_group az_admin_username=azureuser az_vm_size=Standard_ND96isr_H100_v5 az_image=my-custom-rhelai-image sshpubkey=USDHOME/.ssh/id_rsa.pub disk_size=1024 You can launch your instance, by running the following command: USD az vm create \ --resource-group USDaz_resource_group \ --name USD{name} \ --image USD{az_image} \ --size USD{az_vm_size} \ --location USD{az_location} \ --admin-username USD{az_admin_username} \ --ssh-key-values @USDsshpubkey \ --authentication-type ssh \ --nic-delete-option Delete \ --accelerated-networking true \ --os-disk-size-gb 1024 \ --os-disk-name USD{name}-USD{az_location} Verification To verify that your Red Hat Enterprise Linux AI tools are installed correctly, run the ilab command: USD ilab Example output USD 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

Commands:
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" } } ]
keyctl new_session azcopy login
az_location=eastus
az_resource_group=Default az group create --name USD{az_resource_group} --location USD{az_location}
az_storage_account=THE_NAME_OF_YOUR_STORAGE_ACCOUNT
az storage account create --name USD{az_storage_account} --resource-group USD{az_resource_group} --location USD{az_location} --sku Standard_LRS
az_storage_container=NAME_OF_MY_BUCKET az storage container create --name USD{az_storage_container} --account-name USD{az_storage_account} --public-access off
az account list --output table
az_subscription_id=46c08fb3-83c5-4b59-8372-bf9caf15a681
az role assignment create --assignee user@example.com --role "Storage Blob Data Contributor" --scope /subscriptions/USD{az_subscription_id}/resourceGroups/USD{az_resource_group}/providers/Microsoft.Storage/storageAccounts/USD{az_storage_account}/blobServices/default/containers/USD{az_storage_container}
image_name=rhel-ai-1.3
az_vhd_url="https://USD{az_storage_account}.blob.core.windows.net/USD{az_storage_container}/USD(basename USD{vhd_file})" azcopy copy "USDvhd_file" "USDaz_vhd_url"
az image create --resource-group USDaz_resource_group --name "USDimage_name" --source "USD{az_vhd_url}" --location USD{az_location} --os-type Linux --hyper-v-generation V2
az login
az vm list-sizes --location <region> --output table
name=my-rhelai-instance az_location=eastus az_resource_group=my_resource_group az_admin_username=azureuser az_vm_size=Standard_ND96isr_H100_v5 az_image=my-custom-rhelai-image sshpubkey=USDHOME/.ssh/id_rsa.pub disk_size=1024
az vm create --resource-group USDaz_resource_group --name USD{name} --image USD{az_image} --size USD{az_vm_size} --location USD{az_location} --admin-username USD{az_admin_username} --ssh-key-values @USDsshpubkey --authentication-type ssh --nic-delete-option Delete --accelerated-networking true --os-disk-size-gb 1024 --os-disk-name USD{name}-USD{az_location}
ilab
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