Redhat-developer
Redhat Developer
Sign up for a No-cost Red Hat Enterprise Linux Individual Developer Subscription, https://developers.redhat.com/articles/faqs-no-cost-red-hat-enterprise-linux#general this gives licences to use RHEL9, Redhat insights etc.
Building Hosts and deploying on ESXi without vSphere
Go to Redhat Insights https://console.redhat.com/insights/ and create a Blueprint (Inventory -> Images -> Blueprint) chose the Image Output to be VMware vSphere - Virtual Disk (vmdk) use this Blueprint to generate an Image https://console.redhat.com/insights/image-builder
Download the vmdk, copy to the ESXi storage.
The images have a fat 4GB disk, at this point its worth turning that into a thin provisioned disk
- Enable SSH on the ESXi host
- SSH in and cf to `/vmfs/volumes` follow the symlink to to the storage these master images are kept, and into their folder
- Make a copy of the disk that is thin provisioned
vmkfstools -i rhel9-20240531.vmdk rhel9-20240531-thin.vmdk -d 'thin'
Generate userdata and metadata
On a secure host, create userdata.yaml
#cloud-config users: - name: myusername sudo: "ALL=(ALL) NOPASSWD:ALL" ssh_authorized_keys: - ssh-ed25519 PUBLIC_KEY mykey@home.com
create metadata.yaml
instance-id: cloud-vm local-hostname: rhel9-image
Copy the base64-gzip versions of the two config files to a safeplace
Generate metadata from cli with the correct hostname (replace rhel9-image with hostname)
echo METADATA= && echo "instance-id: cloud-vm\nlocal-hostname: rhel9-image" | gzip | base64
echo METADATA= && gzip -c9 <metadata.yaml | { base64 -w0 2>/dev/null || base64; }
echo USERDATA= && gzip -c9 <userdata.yaml | { base64 -w0 2>/dev/null || base64; }
They can be checked by reversing the process
echo "H4sIAAt2SWcCA8vMKy5JzEtO1c1MsVJIzskvTdEty+XKyU9OzNHNyC8uyUvMTbVSKMpIzbHUzcxNTE/lAgABQg8LMgAAAA" | base64 -d | gunzip instance-id: cloud-vm local-hostname: rhel9-image gunzip: truncated input
Create a new VM
- Generate a new VM, remove all harddisks.
- Once the VM has been created, copy the vmdk to the new VM's folder.
- Attach the disk to the VM
- Edit -> VM Options -> Advanced -> Edit Configuration, add the following keys and values
- guestinfo.metadata.encoding=gzip+base64
- guestinfo.userdata.encoding=gzip+base64
- guestinfo.metadata=${METADATA} <from step above>
- guestinfo.userdata=${USERDATA} <from step above>
SAVE
Remember to go back and expand the harddisk
Boot the VM, the user will be created and the VM will be registered with RHEL Insights
Find the IP Address from the ESXi GUI. ssh in and have a coffee
Rename the host
If you were lazy and used the metadata file from another build, rename the host
sudo hostnamectl set-hostname new.host sudo init 6