A photograph of a freshly burned DVD-R that cl...

A photograph of a freshly burned DVD-R that clearly illustrates the Zone-CLV recording strategy used by high speed (in this case, 16x) DVD recorders. (Photo credit: Wikipedia)

Setting up the build directory:

 

The first thing to do is to copy all the cdrom ISOs to one location:

 

#mkdir -p /mnt/disk{1,2,3,4}

#mount -o loop RHEL6-disc1.iso /mnt/disk1

#mount -o loop RHEL6-disc2.iso /mnt/disk2

#mount -o loop RHEL6-disc3.iso /mnt/disk3

#mount -o loop RHEL6-disc4.iso /mnt/disk4

 

We now copy all the files from the directories to a single directory:

 

#mkdir -p /os/isobuild

#rsync -rv /mnt/disk{4,3,2,1}/* /os/isobuild/

 

We also need to copy across the .diskinfo file that is not caught by our *:

 

#cp /mnt/disk1/.diskinfo /os/isobuild/

 

The .diskinfo file identifies the CD as being a correct Red Hat Installer disk and is checked by anaconda during the start of the install.

 

 

Adding more software to the DVD

 

We could add some of our own rpms to /os/isobuild/RedHat/RPMS; however by just doing this does not make them available at install time.

 

There is an XML file  that is read and ensures that the packages are installed in the correct order.

 

So let us throw a few random packages into the mix:

 

Add some rpm:

#cp . libvirt-0.9.4-23.el6_2.1.x86_64.rpm /os/isobuild/RedHat/RPMS/

 

 

Updating the comps.xml file

 

We need to ensure that the host computer has anaconda and anaconda-runtime installed:

 

#up2date anaconda anaconda-runtime

 

Before we update the XML dependency file we need to sort out package orders.  If you have added a lot of new packages you may need to remove some old packages that you have replaced with newer versions to stop conflicts.

 

So the first command is:

#PYTHONPATH=/usr/lib/anaconda /usr/lib/anaconda-runtime/pkgorder /os/isobuild/ x86_64 > /os/isobuild/xander-pkgorder

 

This creates a list of files in the order it needs to install them in the file /os/isobuild/xander-pkgorder. Sometimes an occasional

RPM will not provide the information anaconda needs.  You can edit the file manually and insert your RPMs at the end.

 

Next we need to generate the dependency file:

 

#/usr/lib/anaconda-runtime/genhdlist –fileorder /os/isobuild/xander-pkgorder /os/isobuild/

 

You will probably have a few hiccoughs the first time you run these commands. Most may be resolved by adding the missing entries to the pkgorder file or deleting duplicate packages.

 

Creating an automated installer

 

We could *now* if we wanted to build our DVD; however we can make an automated installer.

 

So crack open system-config-kickstart and create a kickstart file with all the packages and partitioning etc you need for your systems.

 

copy the resulting file to /os/isobuild/ks.cfg

 

we can now edit the file /os/isobuild/isolinux/isolinux.cfg

 

copy or change the three lines:

label linux

kernel vmlinuz

append initrd=initrd.img ramdisk_size=2048

 

to

label xander

  kernel vmlinuz

  append initrd=initrd.img ramdisk_size=2048 ks=cdrom:/ks.cfg

 

Then change the default at the top of the file to xander.  This means that the default action is to install directly from the DVD using your kickstart file.

 

Building the DVD iso

 

Now to build the iso:

 

#cd  /os/isobuild

 

#chmod a+w isolinux/isolinux.bin

 

#mkisofs -r -T -J -V “Custom RHEL6 Build” -b isolinux/isolinux.bin  -c isolinux/boot.cat -no-emul-boot -boot-load-size 4  -boot-info-table -o /os/custom-RHEL6-dvd.iso  /os/isobuild/

 

Buring the DVD

Now we can burn the image to the CD. I assume the CD writer is already set up on your system. We use cdrecord below, but you can use other programs as well. The command is invoked as:

 

#cdrecord -v speed=4 dev=0,0,0 /os/custom-RHEL6-dvd.iso

 

The speed and dev options depend on your system. The device for the dev argument can be determined by using the -scanbus option to cdrecord:

 

#cdrecord -scanbus

 

 

Using the DVD

 

Once the image is burned onto the DVD, insert the DVD into the target machine and boot the machine. You should get the custom message that you created earlier. At this point, you can either press Enter at the boot prompt or let it timeout. When it times out it uses the default label, which we specified as ks (Kickstart).