Skip to content

Instantly share code, notes, and snippets.

@jianzzha
Last active January 10, 2022 13:24
Show Gist options
  • Save jianzzha/050293ae28af8d585f059b18b6916533 to your computer and use it in GitHub Desktop.
Save jianzzha/050293ae28af8d585f059b18b6916533 to your computer and use it in GitHub Desktop.
How to pxe boot Assisted installer ISO image
1) Download the discovery iso image, small size bootable is ok, no need to download the full image
2) mkdir -p /mnt/iso && mount -o ro,loop *iso /mnt/iso && mkdir -p /mnt/efiboot
&& mount -o loop,ro /mnt/iso/images/efiboot.img /mnt/efiboot
3) optionally install web server if downloading from openshift mirror is slow. Assume the http root directory is /var/www/html,
curl -L -o /var/www/html/rhcos-live-rootfs.x86_64.img https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/4.9/4.9.0/rhcos-live-rootfs.x86_64.img
4) install dnsmasq and tftp service. Assume tftp root is /var/lib/tftpboot
/bin/cp -f /mnt/iso/images/*.img /var/lib/tftpboot
/bin/cp -f /mnt/iso/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot
/bin/cp -f /mnt/efiboot/EFI/redhat/{shimx64.efi,grubx64.efi} /var/lib/tftpboot
cat <<EOF > /var/lib/tftpboot/grub.cfg
set timeout=1
menuentry 'Install Red Hat Enterprise Linux CoreOS' --class fedora --class gnu-linux --class gnu --class os {
linuxefi vmlinuz random.trust_cpu=on ignition.firstboot ignition.platform.id=metal 'coreos.live.rootfs_url=https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/4.9/4.9.0/rhcos-live-rootfs.x86_64.img'
initrdefi initrd.img ignition.img
}
EOF
5) sample dnsmasq setting
enable-tftp
tftp-root=/var/lib/tftpboot
dhcp-vendorclass=BIOS,PXEClient:Arch:00000
dhcp-boot=tag:BIOS,lpxelinux.0
dhcp-boot=tag:!BIOS,shimx64.efi
or simply enforce UEFI and not to support legacy boot,
enable-tftp
tftp-root=/var/lib/tftpboot
dhcp-boot=shimx64.efi
6) boot the server
pxe_opt="options=efiboot"
ipmitool -I lanplus -H ${ipmi_addr} -U ${ipmi_user} -P ${ipmi_password} chassis bootdev pxe ${pxe_opt}
ipmitool -I lanplus -H ${ipmi_addr} -U ${ipmi_user} -P ${ipmi_password} chassis power cycle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment