Installing Red Hat Enterprise Linux AI 1.2 Installation documentation on various platforms Red Hat RHEL AI Documentation Team

Commands:
use the embedded container image ostreecontainer --url=/run/install/repo/container --transport=oci --no-signature-verification switch bootc to point to Red Hat container image for upgrades %post bootc switch --mutate-in-place --transport registry registry.redhat.io/rhelai1/bootc-nvidia-rhel9:1.1 touch /etc/cloud/cloud-init.disabled %end ## user customizations follow customize this for your target system network environment network --bootproto=dhcp --device=link --activate customize this for your target system desired disk partitioning clearpart --all --initlabel --disklabel=gpt reqpart --add-boot part / --grow --fstype xfs services can also be customized via Kickstart firewall --disabled services --enabled=sshd optionally add a user user --name=cloud-user --groups=wheel --plaintext --password <password> sshkey --username cloud-user "ssh-ed25519 AAAAC3Nza....." if desired, inject an SSH key for root rootpw --iscrypted locked sshkey --username root "ssh-ed25519 AAAAC3Nza..." reboot
mkksiso rhelai-bootc.ks <downloaded-iso-image> rhelai-bootc-ks.iso
customize this for your target system network environment network --bootproto=dhcp --device=link --activate customize this for your target system desired disk partitioning clearpart --all --initlabel --disklabel=gpt reqpart --add-boot part / --grow --fstype xfs customize this to include your own bootc container ostreecontainer --url quay.io/<your-user-name>/nvidia-bootc:latest services can also be customized via Kickstart firewall --disabled services --enabled=sshd optionally add a user user --name=cloud-user --groups=wheel --plaintext --password <password> sshkey --username cloud-user "ssh-ed25519 AAAAC3Nza....." if desired, inject an SSH key for root rootpw --iscrypted locked sshkey --username root "ssh-ed25519 AAAAC3Nza..." reboot
mkksiso rhelai-bootc.ks <downloaded-iso-image> rhelai-bootc-ks.iso
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/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
export BUCKET=<custom_bucket_name> export RAW_AMI=nvidia-bootc.ami export AMI_NAME="rhel-ai" export DEFAULT_VOLUME_SIZE=1000
aws s3 mb s3://USDBUCKET
printf '{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "vmie.amazonaws.com" }, "Action": "sts:AssumeRole", "Condition": { "StringEquals":{ "sts:Externalid": "vmimport" } } } ] }' > trust-policy.json
aws iam create-role --role-name vmimport --assume-role-policy-document file://trust-policy.json
printf '{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":[ "s3:GetBucketLocation", "s3:GetObject", "s3:ListBucket" ], "Resource":[ "arn:aws:s3:::%s", "arn:aws:s3:::%s/*" ] }, { "Effect":"Allow", "Action":[ "ec2:ModifySnapshotAttribute", "ec2:CopySnapshot", "ec2:RegisterImage", "ec2:Describe*" ], "Resource":"*" } ] }' USDBUCKET USDBUCKET > role-policy.json
aws iam put-role-policy --role-name vmimport --policy-name vmimport-USDBUCKET --policy-document file://role-policy.json
curl -Lo disk.raw <link-to-raw-file>
aws s3 cp disk.raw s3://USDBUCKET/USDRAW_AMI
printf '{ "Description": "my-image", "Format": "raw", "UserBucket": { "S3Bucket": "%s", "S3Key": "%s" } }' USDBUCKET USDRAW_AMI > containers.json
task_id=USD(aws ec2 import-snapshot --disk-container file://containers.json | jq -r .ImportTaskId)
aws ec2 describe-import-snapshot-tasks --filters Name=task-state,Values=active
snapshot_id=USD(aws ec2 describe-import-snapshot-tasks | jq -r '.ImportSnapshotTasks[] | select(.ImportTaskId=="'USD{task_id}'") | .SnapshotTaskDetail.SnapshotId')
aws ec2 create-tags --resources USDsnapshot_id --tags Key=Name,Value="USDAMI_NAME"
ami_id=USD(aws ec2 register-image --name "USDAMI_NAME" --description "USDAMI_NAME" --architecture x86_64 --root-device-name /dev/sda1 --block-device-mappings "DeviceName=/dev/sda1,Ebs={VolumeSize=USD{DEFAULT_VOLUME_SIZE},SnapshotId=USD{snapshot_id}}" --virtualization-type hvm --ena-support | jq -r .ImageId)
aws ec2 create-tags --resources USDami_id --tags Key=Name,Value="USDAMI_NAME"
aws ec2 describe-images --owners self
aws ec2 describe-security-groups
aws ec2 describe-subnets
instance_name=rhel-ai-instance ami=<ami-id> instance_type=<instance-type-size> key_name=<key-pair-name> security_group=<sg-id> disk_size=<size-of-disk>
aws ec2 run-instances --image-id USDami --instance-type USDinstance_type --key-name USDkey_name --security-group-ids USDsecurity_group --subnet-id USDsubnet --block-device-mappings DeviceName=/dev/sda1,Ebs='{VolumeSize='USDdisk_size'}' --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value='USDinstance_name'}]'
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/cloud--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 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
ibmcloud login
ibmcloud login API endpoint: https://cloud.ibm.com Region: us-east Get a one-time code from https://identity-1.eu-central.iam.cloud.ibm.com/identity/passcode to proceed. Open the URL in the default browser? [Y/n] > One-time code > Authenticating OK Select an account: 1. <account-name> 2. <account-name-2> API endpoint: https://cloud.ibm.com Region: us-east User: <user-name> Account: <selected-account> Resource group: No resource group targeted, use 'ibmcloud target -g RESOURCE_GROUP'
ibmcloud plugin install cloud-object-storage infrastructure-service
ibmcloud target -g Default
ibmcloud target -r us-east
ibmcloud catalog service cloud-object-storage --output json | jq -r '.[].children[] | select(.children != null) | .children[].name'
cos_deploy_plan=premium-global-deployment
cos_si_name=THE_NAME_OF_YOUR_SERVICE_INSTANCE
ibmcloud resource service-instance-create USD{cos_si_name} cloud-object-storage standard global -d USD{cos_deploy_plan}
cos_crn=USD(ibmcloud resource service-instance USD{cos_si_name} --output json| jq -r '.[] | select(.crn | contains("cloud-object-storage")) | .crn')
ibmcloud cos config crn --crn USD{cos_crn} --force
bucket_name=NAME_OF_MY_BUCKET
ibmcloud cos bucket-create --bucket USD{bucket_name}
cos_si_guid=USD(ibmcloud resource service-instance USD{cos_si_name} --output json| jq -r '.[] | select(.crn | contains("cloud-object-storage")) | .guid')
ibmcloud iam authorization-policy-create is cloud-object-storage Reader --source-resource-type image --target-service-instance-id USD{cos_si_guid}
curl -Lo disk.qcow2 "PASTE_HERE_THE_LINK_OF_THE_QCOW2_FILE"
image_name=rhel-ai-20240703v0
ibmcloud cos upload --bucket USD{bucket_name} --key USD{image_name}.qcow2 --file disk.qcow2 --region <region>
ibmcloud is image-create USD{image_name} --file cos://<region>/USD{bucket_name}/USD{image_name}.qcow2 --os-name red-ai-9-amd64-nvidia-byol
image_id=USD(ibmcloud is images --visibility private --output json | jq -r '.[] | select(.name=="'USDimage_name'") | .id')
while ibmcloud is image --output json USD{image_id} | jq -r .status | grep -xq pending; do sleep 1; done
ibmcloud is image USD{image_id}
ibmcloud login -c <ACCOUNT_ID> -r <REGION> -g <RESOURCE_GROUP>
ibmcloud plugin install infrastructure-service
ssh-keygen -f ibmcloud -t ed25519
ibmcloud is key-create my-ssh-key @ibmcloud.pub --key-type ed25519
ibmcloud is floating-ip-reserve my-public-ip --zone <region>
ibmcloud is instance-profiles
name=my-rhelai-instance vpc=my-vpc-in-us-east zone=us-east-1 subnet=my-subnet-in-us-east-1 instance_profile=gx3-64x320x4l4 image=my-custom-rhelai-image sshkey=my-ssh-key floating_ip=my-public-ip disk_size=250
ibmcloud is instance-create USDname USDvpc USDzone USDinstance_profile USDsubnet --image USDimage --keys USDsshkey --boot-volume '{"name": "'USD{name}'-boot", "volume": {"name": "'USD{name}'-boot", "capacity": 'USD{disk_size}', "profile": {"name": "general-purpose"}}}' --allow-ip-spoofing false
ibmcloud is floating-ip-update USDfloating_ip --nic primary --in USDname
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/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 model_list serve model serve sysinfo system info test model test train model train
name=my-rhelai-instance
data_volume_size=1000
ibmcloud is instance-volume-attachment-add data USD{name} --new-volume-name USD{name}-data --profile general-purpose --capacity USD{data_volume_size}
lsblk
disk=/dev/vdb
sgdisk -n 1:0:0 USDdisk
mkfs.xfs -L ilab-data USD{disk}1
echo LABEL=ilab-data /mnt xfs defaults 0 0 >> /etc/fstab
systemctl daemon-reload
mount -a
chmod 1777 /mnt/
echo 'export ILAB_HOME=/mnt' >> USDHOME/.bash_profile
source USDHOME/.bash_profile
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: USD gcloud config set project PROJECT_ID
gcloud_project=your-gcloud-project gcloud config set project USDgcloud_project
gcloud_region=us-central1
gcloud_bucket=name-for-your-bucket gsutil mb -l USDgcloud_region gs://USDgcloud_bucket
FROM registry.redhat.io/rhelai1/bootc-nvidia-rhel9:1.2 RUN eval USD(grep VERSION_ID /etc/os-release) && echo -e "[google-compute-engine]\nname=Google Compute Engine\nbaseurl=https://packages.cloud.google.com/yum/repos/google-compute-engine-elUSD{VERSION_ID/.*}-x86_64-stable\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=0\ngpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg\n https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg" > /etc/yum.repos.d/google-cloud.repo && dnf install -y --nobest acpid cloud-init google-compute-engine google-osconfig-agent langpacks-en rng-tools timedatex tuned vim && curl -sSo /tmp/add-google-cloud-ops-agent-repo.sh https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh && bash /tmp/add-google-cloud-ops-agent-repo.sh --also-install --remove-repo && rm /tmp/add-google-cloud-ops-agent-repo.sh && mkdir -p /var/lib/rpm-state && dnf remove -y irqbalance microcode_ctl && rmdir /var/lib/rpm-state && rm -f /etc/yum.repos.d/google-cloud.repo && sed -i -e '/^pool /c\server metadata.google.internal iburst' /etc/chrony.conf && echo -e 'PermitRootLogin no\nPasswordAuthentication no\nClientAliveInterval 420' >> /etc/ssh/sshd_config && echo -e '[InstanceSetup]\nset_boto_config = false' > /etc/default/instance_configs.cfg && echo 'blacklist floppy' > /etc/modprobe.d/blacklist_floppy.conf && echo -e '[install]\nkargs = ["net.ifnames=0", "biosdevname=0", "scsi_mod.use_blk_mq=Y", "console=ttyS0,38400n8d", "cloud-init=disabled"]' > /usr/lib/bootc/install/05-cloud-kargs.toml
GCP_BOOTC_IMAGE=quay.io/yourquayusername/bootc-nvidia-rhel9-gcp podman build --file Containerfile --tag USD{GCP_BOOTC_IMAGE} .
[customizations.kernel] name = "gcp" append = "net.ifnames=0 biosdevname=0 scsi_mod.use_blk_mq=Y console=ttyS0,38400n8d cloud-init=disabled"
mkdir -p build/store build/output podman run --rm -ti --privileged --pull newer -v /var/lib/containers/storage:/var/lib/containers/storage -v ./build/store:/store -v ./build/output:/output -v ./config.toml:/config.toml quay.io/centos-bootc/bootc-image-builder --config /config.toml --chown 0:0 --local --type raw --target-arch x86_64 USD{GCP_BOOTC_IMAGE}
image_name=rhel-ai-1-2
raw_file=<path-to-raw-file> tar cf rhelai_gcp.tar.gz --transform "s|USDraw_file|disk.raw|" --use-compress-program=pigz "USDraw_file"
gsutil cp rhelai_gcp.tar.gz "gs://USD{gcloud_bucket}/USDimage_name.tar.gz"
gcloud compute images create "USDimage_name" --source-uri="gs://USD{gcloud_bucket}/USDimage_name.tar.gz" --family "rhel-ai" --guest-os-features=GVNIC
gcloud auth login
gcloud compute machine-types list --zones=<zone>
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
gcloud config set compute/zone USDzone
gcloud compute instances create USD{name} --machine-type USD{machine_type} --image USDimage --zone USDzone --subnet USDsubnet --boot-disk-size USD{disk_size} --boot-disk-device-name USD{name} --accelerator=USDaccelerator
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/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
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.2
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/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