Create your custom CentOS install disc in Mac OS X 1


This article explains how to quickly create a bootable CentOS ISO containing your own custom kickstart files. This image can be used to do an automated deployment of CentOS on a virtual or (if you burn the image to a CD/DVD) physical server. I’ve used the mkisofs command to generate the actual ISO file. mkisofs is part of the open source ‘crdtools’ package and can be installed using the MacPorts package management system. This means you should first install MacPorts using the Quickstart guide available at the MacPort Project web page before starting with the instructions below.

Open Terminal.app and install the ‘cdrtools’ package from MacPorts Project:

sudo port install cdrtools

Create a folder to store your ISO images. I will use ~/iso in this example:

mkdir ~/iso

Move a CentOS ISO to this directory. I used the CentOS-6.5-x86_64-minimal.iso file which is available at ftp.nluug.nl. Copy the contents to a working directory:

hdiutil mount ~/iso/CentOS-6.5-x86_64-minimal.iso
cd ~/iso && cp -aR /Volumes/CentOS_6.5_Final tmp

Change the permissions on the working directory and the isolinux.bin file:

chmod u+w ~/iso/tmp && chmod u+w ~/iso/tmp/isolinux/isolinux.bin

Copy your kickstart files to a location in the working directory, e.g. ~/iso/tmp/ks :

mkdir ~/iso/tmp/ks
cp /<path>/<to>/<your>/<kickstart>/<files>/*.cfg ~/iso/tmp/ks/.

Edit the SYSLINUX boot menu:

vi ~/iso/tmp/isolinux/isolinux.cfg

To add an option to boot your my.cfg kickstart file (which is in the ~/iso/tmp/ks directory) by default add the following lines to the appropriate sections:

1
2
3
4
5
6
7
8
9
…
timeout 60
…
label mylinux
  menu label ^Install a system using my custom kickstart file
  menu default
  kernel vmlinuz
  append initrd=initrd.img ks=cdrom:/ks/my.cfg
…

Don’t forget to remove the menu default line for the label linux entry. If you would like to change the time it takes before the default option is booted automatically, adjust the timeout option. The value is in units of 1/10 s. For more options and information check the syslinux.org web page.

Finally create your custom ISO:

cd ~/iso/tmp && mkisofs -R \
-no-emul-boot -boot-load-size 4 \
-boot-info-table -joliet-long \
-o ../my-custom-centos.iso \
-b isolinux/isolinux.bin \
-c isolinux/boot.cat \
-V "My custom CentOS installer" .

You can now remove the working directory and unmount the CentOS ISO. Use VirtualBox or VMware Fusion to test your ISO. Note that it is not possible to add custom packages with this setup, since the createrepo command is not available on Mac OS X to create the package metadata.


Leave a comment

Your email address will not be published. Required fields are marked *

One thought on “Create your custom CentOS install disc in Mac OS X