<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d11356004\x26blogName\x3dxception\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://openrent.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://openrent.blogspot.com/\x26vt\x3d-4655156434419967503', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

One Kickstart to rule them all

If you're like me, you run multiple flavors of Red Hat in your company. Some servers run RHEL3 due to application requirements, some newer servers run the AMD64 version of RHEL 4, and some non-critical "utility" servers run Fedora Core 4. It seems the number of Linux servers is always multiplying, and manually installing each server is a time-consuming, laborious process. To counter this problem, I usually create a kickstart-enabled cdrom for each flavor of Red Hat.

Since Linux is always being updated, the number of cdroms seems to multiply like mushrooms after a rainstorm. There was always a new distro, but I sometimes needed to install an older distribution. To solve that problem, I set out to create ONE cdrom that would let me kickstart any flavor of Linux that I chose. I wanted to create the Swiss army knife of kickstart installs!

The tutorial below will show you how to do precisely that.

I'm going to assume you know how to create and modify a kickstart file. If you do not, you can learn more here and here. Put simply, a kickstart file is a text file that contains answers to all of the questions asked by the anaconda installer. The beauty of kickstart is the ability to customize your server builds to your exact needs, and build a new server in mere minutes.

I will also assume that you have a remote repository, accessible via HTTP, FTP, or NFS. This repository hosts the cdrom contents of each Red Hat OS you wish to install. A previous blog entry defines how to create such a repository. Since I try not to reinvent the wheel, I went looking for anyone who tried to do this before me. I came across Don O'Neill's excellent article, "Creating a Single Installation CD for Red Hat/Fedora Distributions" and used it as my jumping off point.

The first step is to ensure you have the ISO image of disk 1 for each distribution. We will be extracting needed files from these images. In this case, we will be working with the AMD64 version of RHEL 4.0.

Create the following scratch directories to contain your work:
mkdir -p /installcd/isolinux
mkdir -p /installcd/t1
mkdir -p /installcd/t2


Mount the first CD from one distribution into the /installcd/t1 directory.
mount -o loop RHEL4-U1-x86_64-AS-disc1.iso /installcd/t1/


Mount the boot image from /installcd/t1 into the /installcd/t2 directory.
mount -o loop /installcd/t1/images/boot.iso /installcd/t2


Copy the kernel (vmlinuz file) to an distribution-specific directory under the /installcd/isolinux directory.
mkdir -p /installcd/isolinux/RHEL4_AMD

cp /installcd/t2/isolinux/vmlinuz \ /installcd/isolinux/RHEL4_AMD


Extract the initial ramdisk (initrd) file to the same directory:
cp /installcd/t2/isolinux/initrd.img \ /installcd/isolinux/RHEL4_AMD.img


Copy the following files from the /isolinux directory on disc 1 of any Red Hat release into your /installcd/isolinux directory:
boot.cat
boot.msg
isolinux.bin
isolinux.cfg
splash.lss


Edit the isolinux.cfg file to look like similar to this:
timeout 600
prompt 1
display boot.msg

# ------------------------------------------
# Red Hat Enterprise Linux 4.0 Update 1 AMD
# ------------------------------------------
label RHEL4AMD
kernel RHEL4AMD
append ks=cdrom:/isolinux/RHEL4AMD_ks.cfg \ initrd=RHEL4AMD.img ramdisk_size=8192

Finally, name your kickstart file RHEL4AMD_ks.cfg, and move it into the /installcd/t2/isolinux/ directory.

If you wanted to add another distribution, say Fedora Core 4, you would simply repeat this process. You simply need to grab the kernel and initrd files, place them in the proper directory, and add an entry for it in the isolinux.cfg file.

Once you are done adding distributions for your cd, create a new ISO file from the contents of the /installcd/isolinux directory. You will need to have the mkisofs package installed before performing this step.
cd /installcd/isolinux
mkisofs -o /root/multiple.iso -b isolinux/ISOLINUX.BIN -c isolinux/BOOT.CAT -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T /installcd

Burn the ISO file named multiple.iso to a blank cdrom.
cdrecord -scanbus
cdrecord -v dev=2,0,0 driveropts=burnfree /root/multiple.iso

That's it. Your CDROM is now ready to kickstart any flavor of Red Hat.