CentOS 7.4 and 7.5
Works with: UEFI or BIOS
To start we need the installation files in our /tftpboot/os/centos directory. This can be done by manually copying the required content from a CentOS iso or by using rsync to sync from an online mirror. A list of official mirrors with rsync links can be found here. The following will presume the latest version of CentOS (at this time 7.5.1804) but altering the version to your desired version in the steps should work.
You do not have to do the steps in BOTH “Using Files from ISO” and “From rsync”, its one or the other.
Using Files from ISO:
Create the directory for CentOS/version if it doesnt already exist:
mkdir -p /tftpboot/os/centos/7.5.1804
Mount the ISO and copy the required files to the above directory:
mount /{path to the iso}/filename.iso /mnt/iso/
cp -R /mnt/iso/* /tftpboot/os/centos/7.5.1804
umount /mnt/iso
Using rsync:
Do not create the subdirectory for the CentOS version, just have /tftpboot/os/centos ready, rsync will create the subdirectory.
run the rsync command using a rsync url from the list of mirrors you want to use. This can take hours to run:
rsync -avzP --log-file=/var/log/rsync_cron/rsync_yum_mirror.log --delete --include="/7.5.1804" --include="/7.5.1804/**" --exclude="*" rsync://mirrorurl/centos/7.5.1804/os/x86_64/ /tftpboot/os/centos
feel free to change the path/name of the log file. I use this rsync to also pull updates allowing me to use my FOG server as a local YUM repo as well. If interested in doing so change the rsync path to be rsync://mirrorurl/centos/ instead. This will make the amount of data downloaded much greater, but will later let you use the FOG server as a YUM repo. I placed the rsync command above in my crontab -e without the -P switch for rsync and have it sync once a day. Doing so is a bit beyond the context of this guide though.
Also note that if the mirror is down the command can fail, you may need to switch to another mirror or if setting up cron having it sync multiple mirrors just in case.
Adding iPXE entry:
From the FOG web GUI, create a new iPXE entry (or edit an existing one) as follows:
Menu Item: name as desired (ex: os.centoslatest)
Description: as desired (ex: CentOS 7.5.1804 - Install). Note: This is what is seen in the iPXE menu on the host machine!
Parameters:
Manual or rsync without wanting YUM server too:
kernel http://${fog-ip}/os/centos/7.5.1804/images/pxeboot/vmlinuz
initrd http://${fog-ip}/os/centos/7.5.1804/images/pxeboot/initrd.img
imgargs vmlinuz initrd=initrd.img root=live:http://${fog-ip}/os/centos/7.5.1804/LiveOS/squashfs.img repo=http://${fog-ip}/os/centos/7.5.1804
boot || goto MENU
With rsync pulling all data for YUM:
kernel http://${fog-ip}/os/centos/7.5.1804/os/x86_64/images/pxeboot/vmlinuz
initrd http://${fog-ip}/os/centos/7.5.1804/os/x86_64/images/pxeboot/initrd.img
imgargs vmlinuz initrd=initrd.img root=live:http://${fog-ip}/os/centos/7.5.1804/os/x86_64/LiveOS/squashfs.img repo=http://${fog-ip}/os/centos/7.5.1804/os/x86_64
boot || goto MENU
Menu Show With: as desired.
Save changes
Alternate directions here.