Using iPXE to install RHEL 6.4

It took me a bit of experimenting to get RHEL 6.4 install booting using iPXE, especially when passing the correct network device to the installer, so that it knows which interface to use when accessing the repositories.

The below iPXE script got me installing in the end, so I thought I would share.

#!ipxe

echo Booting RHEL 6.4 x86_64
imgfree
set base-url http://${next-server}/rhel64/
kernel ${base-url}images/pxeboot/vmlinuz ksdevice=${netX/mac} ks=${base-url}ks.cfg
initrd ${base-url}images/pxeboot/initrd.img
imgstat
boot

You might notice the ksdevice line in the above kernel command. This is possibly the most important part of doing a successful unattended install, as it tells the installer which interface is used to access the kickstart file and any installation media. Setting this to ${netX/mac} passes the MAC (hardware) address of this interface through to the installer, which works out the correct interface based on this. I saw a lot of different methods for achieving this, but this method is by far the most reliable and simplest I was able to come up with when booting RHEL.

The variable base-url uses the variable next-server, which is the IP address of the server the machine was PXE-booted from. You will likely need to modify base-url to match the directory on your HTTP server where the RHEL 6.4 installation DVD is extracted.

You can simply copy the files from the mounted DVD (or loop mounted) to a directory in your HTTP server's path, no modification necessary. You should also place your kickstart file, if you are using one, in this same directory. If it is not called ks.cfg, you should change the end of the kernel line in the above script to reflect the correct file name.

If you are not using a kickstart file, you can remove the ksdevice and ks arguments from the kernel command.