These steps will only work for the x86_64 system. For other systems, the steps may be different.
The mkksiso tool, which is part of the lorax package and comes with CentOS 8 and CentOS 9, lets you add a kickstart file to an ISO file. All systems can use it.
Purchase Dedicated Servers
Select, configure, and buy!
For CentOS 9, 8, 7
Mount the DVD iso at some location.
# mount -o loop /PATH/TP/DOWNLOADED/centos-server-7.9-x86_64-dvd.iso /mnt
Then create a directory and copy all the contents of theISO into the same.
# shopt -s dotglob # mkdir /tmp/centos79 # cp -avRf /mnt/* /tmp/centos79
The hidden files should be copied as well. After enabling a dotglob option, '*' includes dot files too. If a ISO image does not include .discinfo, the disk's stage2 won't load, and the customized image won't be of any use for installation purpose.
Verify that all hidden files like .treeinfo are there in /tmp/centos79
# cd /tmp/centos79 # ls -a
# cd /tmp/centos79 # cp /PATH/TO/CREATED/ks.cfg /tmp/centos79/
# grep -A4 "^label linux" /tmp/centos79/isolinux/isolinux.cfg label linux menu label ^Install CentOS Linux 7.9 kernel vmlinuz append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS-7.9\x20Server.x86_64 quiet
label kickstart menu label ^Kickstart Install CentOS Linux 7.9 kernel vmlinuz append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS-7.9\x20Server.x86_64 quiet inst.ks=cdrom:/ks.cfg
$ grep -m 1 -A3 "Install CENTOS Linux" /tmp/centos79/EFI/BOOT/grub.cfg menuentry 'Install CentOS Linux 7.9' --class fedora --class gnu-linux --class gnu --class os { linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CENTOS-7.9\x20Server.x86_64 quiet initrdefi /images/pxeboot/initrd.img }
menuentry 'Kickstart Install CentOS Linux 7.9' --class fedora --class gnu-linux --class gnu --class os { linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CENTOS-7.9\x20Server.x86_64 quiet inst.ks=cdrom:/ks.cfg initrdefi /images/pxeboot/initrd.img }
If you are making a USB, you will want to use "inst.ks=hd:LABEL=CENTOS-7.9\x20Server.x86_64:/ks.cfg" instead of targeting the CDROM.
# cd /tmp/centos79/ # mkisofs -o /tmp/centos79test.iso -b isolinux/isolinux.bin -J -R -l -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -graft-points -joliet-long -V "CENTOS-7.9 Server.x86_64" . # isohybrid --uefi /tmp/centos79test.iso # implantisomd5 /tmp/centos79test.iso
The only difference for CentOS 8 will be the kickstart file and the Volume LABEL.
Mind that there's a dot '.' at the end of the mkisofs command.
For 64-bit ARM in CENTOS9, the isohybrid command is not available and it's not required; use the following mkisofs command instead.
# mkisofs -o /tmp/centos9test-aarch64.iso -J -R -l -c boot.catalog -no-emul-boot -e images/efiboot.img -V "CENTOS-9-0-0-BaseOS-aarch64" .
Purchase Dedicated Servers
Select, configure, and buy!