Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 6. Installing RHEL AI on Azure
For installing and deploying Red Hat Enterprise Linux AI on Azure, 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:
$ az login
Example output of the 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" } } ]
Log in with the
azcopy
tool using the following commands:$ keyctl new_session $ 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:
$ 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 namedDefault
in the locationeastus
. (You can omit this step if you want to use an already existing resource group).$ az_resource_group=Default $ az group create --name ${az_resource_group} --location ${az_location}
Create an Azure storage account and save the name in an environment variable named
az_storage_account
by running the following commands:$ 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
Create your Azure Storage Container named as the environment variable
az_storage_container
with the following commands:$ az_storage_container=NAME_OF_MY_BUCKET $ az storage container create \ --name ${az_storage_container} \ --account-name ${az_storage_account} \ --public-access off
You can get your Subscription ID from the Azure account list by running the following command:
$ az account list --output table
Create a variable named ` az_subscription_id` with your Subscription ID .
$ az_subscription_id=46c08fb3-83c5-4b59-8372-bf9caf15a681
Grant
azcopy
write permission to user into the storage container. This example grants permission to the useruser@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}
- 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.
$ image_name=rhel-ai-1.2
Upload the VHD file to the Azure Storage Container by running the following command:
$ az_vhd_url="https://${az_storage_account}.blob.core.windows.net/${az_storage_container}/$(basename ${vhd_file})" $ azcopy copy "$vhd_file" "$az_vhd_url"
Create an Azure image from the VHD file you just uploaded with the following command:
$ 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
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:
$ 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:
$ 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=$HOME/.ssh/id_rsa.pub disk_size=1024
You can launch your instance, by running the following command:
$ az vm create \ --resource-group $az_resource_group \ --name ${name} \ --image ${az_image} \ --size ${az_vm_size} \ --location ${az_location} \ --admin-username ${az_admin_username} \ --ssh-key-values @$sshpubkey \ --authentication-type ssh \ --nic-delete-option Delete \ --accelerated-networking true \ --os-disk-size-gb 1024 \ --os-disk-name ${name}-${az_location}
Verification
To verify that your Red Hat Enterprise Linux AI tools are installed correctly, run the
ilab
command:$ ilab
Example output
$ 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/auser/.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 convert model convert diff taxonomy diff download model download evaluate model evaluate generate data generate init config init list model list serve model serve sysinfo system info test model test train model train