Custom ISO + Kickstart

Create a Custom ISO image with your kickstart

Install a couple of tools you’ll need later on in this walkthrough.

    sudo yum install -y isomd5sum genisoimage

Download a copy of the CentOS 7 minimal image from your preferred mirror.


Create a directory to mount your source on and loop mount the downloaded iso.

    mkdir /tmp/bootiso 
    mount -o loop CentOS-7-x86_64-Minimal-1810.iso /tmp/bootiso

Now create a working directory for you custom media.

    mkdir /tmp/bootcustom

Copy the source iso media to the custom working directory.

    cp -r /tmp/bootiso/* /tmp/bootcustom

Unmount the source ISO and remove the source directory.

    umount /tmp/bootiso && rmdir /tmp/bootiso

Change permissions on the working directory

    chmod -R u+w /tmp/bootcustom

Copy your .ks script and move to the working directory.

    cp /path/to/yourks.cfg /tmp/bootcustom/isolinux/ks.cfg

Add your kickstart to boot options.

sed -i 's/append\ initrd\=initrd.img/append initrd=initrd.img\ ks\=cdrom:\/ks.cfg/' /tmp/bootcustom/isolinux/isolinux.cfg

Create the new ISO file with genisotools

cd /tmp/bootisoks && \ 
mkisofs -o /tmp/boot.iso -b isolinux.bin -c -no-emul-boot -boot-load-size 4 -boot-info-table -V "CentOS 7 x86_64" -R -J -v -T isolinux/. .

Add an MD5 checksum to your .iso

implantisomd5 /tmp/boot.iso