HOW TO CREATE CUSTOM BUILD ISO & DVD
Log in to server. Be root.
Place source DVD in tray. (Source DVD is the RedHat install DVD).
Execute “mount” command to figure out path to source DVD.
(examine output to see what the path is)
(in my case, path is /media/RHEL_5.3 i386 DVD)
# cd /media/RHEL_5.3\ i386\ DVD
(the backslashes are to escape the spaces in the pathname)
# du -sh .
(see how much space will be necessary to recreate this DVD on the server hard drive)
# df -h
(examine output and select a filesystem on the hard drive that has sufficient space to recreate the DVD there)
(on my system, I selected /0b)
# mkdir /0b/iso_tree
(create a working directory on your selected filesystem)
(make sure you are in the top-level of mounted DVD)
# tar cvf – . | (cd /0b/iso_tree; tar xvpf -)
(recreate the DVD on your hard drive – should take 10 minutes or less)
# ls -a /0b/iso_tree
(make sure you see a listing for .discinfo file)
# cd /0b/iso_tree/isolinux
# mkdir EXTRAS
(In my case, I create this subdirectory because I’ve written some code in my custom ks.cfg file which will copy the contents of the EXTRAS subdirectory into a directory on the server, in the post-installation steps)
(We want to put the custom ks.cfg file in the ./isolinux directory, as the deployment guide I’m writing for work expects to find the ks.cfg file there.)
(In my case, I have these files on a USB stick which is attached to my server at the mount point /media/disk)
# cp /media/disk/ks.cfg /0b/iso_tree/isolinux/ks.cfg
# cp /media/disk/tools.tar.gz /0b/iso_tree/isolinux/EXTRAS/tools.tar.gz
Here you can make it interesting, because you can actually put multiple versions of ks.cfg here, and can pretty much name them what you want; later when you go to build a new server, you will specify the path to the ks.cfg file anyway.
Make the custom ISO image file:
Decide what the ISO image will be called. In my case, I decided to call it “RedHatLinux53-yyyymmdd.iso”, where yyyymmdd represents the year, month, day that I’m creating the file.
# cd /0b/iso_tree
# mkdir /0b/new_iso
(Here you are creating another working directory to put your custom ISO file in – mine needed a little less than 4Gb)
Now you execute the “mkisofs” command to create the custom ISO file. This command is all on one line. You might want to put it in a small shell script and execute it that way to avoid typo errors.
# mkisofs -A “Red Hat Linux 5.3” -V “Red Hat Linux 5.3” -J -R -v -T -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /0b/new_iso/RedHatLinux53-20090901.iso .
(PLEASE NOTE THE “.” at the end of the command – this stands for “current directory”, don’t forget to put this at the end of the command!)
(Should take around 5 minutes to complete)
Mount the newly created ISO image on the loopback device so you can make sure it will work:
# mkdir /0b/mnt_iso
(here you are creating a mount point)
# mount -o loop /0b/new_iso/RedHatLinux5.3-20090901.iso /0b/mnt_iso
(make sure it mounts ok and you can find isolinux/ks.cfg and isolinux/EXTRAS/tools.tar.gz)
# umount /0b/mnt_iso
Now at this point you want to write the ISO image to DVD. Being pressed for time at work, I chose not to investigate the options for using the “cdrecord” command on my Linux server to do that. Instead, I chose to put the ISO file on a USB stick and transfer it over to my PC, then use Roxio to burn a DVD from the ISO image. So here are the instructions for doing that:
# cp /0b/new_iso/RedHatLinux5.3-20090901.iso /media/disk
(On a slow server, took around a half hour)
# eject /media/disk
Remove USB stick from server and attach to PC.
Use Roxio. Use DVD-R, as DVD+R etc. has sometimes caused a problem. Use option to “Burn Image”. Choose the option to “Verify”. (Takes about 20 minutes)
Place DVD in CD tray in the server you want to build. It should boot from DVD. At the Linux boot: prompt, type the command which will initiate the install, using the custom ks.cfg found at isolinux/ks.cfg.
On my server, the path to the DVD is /dev/sda1, so this is the boot command I use:
boot: linux ks=sda1:/isolinux/ks.cfg
(NOTE: you don’t have to type “boot:” that is the prompt you will see.)
If all goes well, the installation will carry on and you won’t be prompted for anything.