I am trying to create a custom ISO image which would install the minimal required RPMS along with some custom written RPM of my app. and Also wants to perform some post install steps like configuring my App and VPN configuration etc.

I saw some of the links on google but they are pointing creating repo and ISO from mounted disk or ISO image.

Thanks Ramesh


1 Answer 1

  1. Create a directory to mount your source.

    mkdir /tmp/bootiso
  2. Loop mount the source ISO you are modifying. (Download from Red Hat / CentOS.)

    mount -o loop /path/to/some.iso /tmp/bootiso
  3. Create a working directory for your customized media.

    mkdir /tmp/bootisoks
  4. Copy the source media to the working directory.

    cp -r /tmp/bootiso/* /tmp/bootisoks/
  5. Unmount the source ISO and remove the directory.

    umount /tmp/bootiso && rmdir /tmp/bootiso
  6. Change permissions on the working directory.

    chmod -R u+w /tmp/bootisoks
  7. Copy your Kickstart script which has been modified for the packages and %post to the working directory.

    cp /path/to/someks.cfg /tmp/bootisoks/isolinux/ks.cfg
  8. Copy any additional RPMs to the directory structure and update the metadata.

    cp /path/to/*.rpm /tmp/bootisoks/Packages/.
    cd /tmp/bootisoks/Packages && createrepo -dpo .. .
  9. Add kickstart to boot options.

    sed -i 's/append\ initrd\=initrd.img/append initrd=initrd.img\ ks\=cdrom:\/ks.cfg/' /tmp/bootisoks/isolinux/isolinux.cfg
  10. Create the new ISO file.

    cd /tmp/bootisoks && \ 
    mkisofs -o /tmp/boot.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V "CentOS 7 x86_64" -R -J -v -T isolinux/. .
  11. (Optional) Use isohybrid if you want to dd the ISO file to a bootable USB key.

    isohybrid /tmp/boot.iso
  12. Add an MD5 checksum (to allow testing of media).

    implantisomd5 /tmp/boot.iso

If you need more help creating the Kickstart script, I suggest starting with the official Red Hat documentation.

  • 1
    Is it possible you missed or botched step 4, then? Dec 9, 2014 at 14:40
  • 3
    @AaronCopley yes, you're probably right. I also found this: github.com/joyent/mi-centos-7 which helped me.
    – sivann
    Dec 11, 2014 at 8:13
  • 1
    On step 9, I believe you must give last parameter . (dot) to indicate current directory. Strange default behavior but without that, mkisofs creates an iso file which contains only the files from the top directory and no subdirectories and beyond.
    – hshib
    Feb 1, 2015 at 19:49
  • 2
    I also had issue with step 4. With that usage of "cp" command it does not copy the hidden files .discinfo and .treeinfo. Without those, created iso fails during the installation complaining that "CD/ROM not found".
    – hshib
    Feb 2, 2015 at 2:06
  • 1
    You can copy everything with single command with - "cp -r /tmp/bootiso/. /tmp/bootisoks/" (this is a little tricky - note single . after /tmp/bootiso/)
    – hshib
    Feb 2, 2015 at 2:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .