Tuesday 26 March 2013

Fun with RHEL 6 kickstart

Why when you want to do something in a hurry do you find that build scripts suddenly stop working? Today I have spent my time trying to resolve issues with repositories and kickstart. The script that I had working for RHEL 5 to build a custom DVD no-longer worked.

RHEL 5 custom DVD creation

To create a custom RHEL 5 DVD do the following.
  • Insert the latest RHEL 5 DVD into the drive of a RHEL 5 Linux machine and copy the contents across to your build directory.
mkdir -p /data/iso-build
cd /data/iso-build
cp -R /media/CDROM/* ./
cp -R /media/CDROM/.[a-zA-Z]* ./
  • You can then edit the ks.cfg and do all sorts of things to customise the install. I won't detail this here.
  • The following is my quick and dirty build script to create the a new .iso file.
createrepo -g /data/iso-build/Server/repodata/comps-rhel6-Server.xml /data/iso-build/Server/
mkisofs -r -J -T -V "RHEL5 32" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /data/RHEL5-custom.iso /data/iso-build

RHEL 6 custom DVD creation

To create a custom RHEL 6 DVD do the following.
  • Insert the latest RHEL 6 DVD into the drive of a RHEL 5 Linux machine and copy the contents across to your build directory.
mkdir -p /data/iso-build
cd /data/iso-build
cp -R /media/CDROM/* ./
cp -R /media/CDROM/.[a-zA-Z]* ./
  • You can then edit the ks.cfg and do all sorts of things to customise the install. I won't detail this here.
  • The following is my quick and dirty build script to create the a new .iso file
createrepo -s sha -g /data/iso-build/Server/repodata/comps-rhel6-Server.xml /data/iso-build/Server/
cp -Rf /data/iso-build/Server/repodata /data/iso-build/
mkisofs -r -J -T -V "RHEL6 32" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /data/RHEL6-custom.iso /data/iso-build
  • There are two main differences. One I have to create the files in create repo with SHA1 not SHA256 which is the new default. Two I now have to copy the repodata directory to the top level from the Server directory. This seems to be needed otherwise anaconda has difficulty finding the yum repository. If the repodata directory doesn't also exist under the Server directory, then anaconda has difficulty finding the rpm files.