Building a custom CentOS 5 kickstart disc, part 3

Note: this series of articles applies to CentOS 5; for CentOS 6, see this series.

Now that you’ve compiled your RPMs, you need to build a disk image from which to perform the kickstart.

Create the repository

Install createrepo so that you can create a repository. If you’ve copied all the RPMs to ~kickstart_build/all_rpms as suggested earlier, just do this:

You need to build the repodata for your install disc. These files provide the installer information about the available packages. On your build machine, you should have already copied the repodata/comps.xml file from the CentOS disc 1 to ~/kickstart_build. Use createrepo to build the repository info.

This will create a repodata directory under ~/kickstart_build/isolinux with the repository data files in it.

Build the ISO

We’re finally ready to build the ISO image that we can burn to CD.

You should now have an ISO image in custom.iso.

Testing the ISO

Rather than spending the time to burn the CD and perform a physical installation, you can use qemu to test your ISO before you burn it. You may have to go through a few iterations to make sure that your kickstart performs the way you want. It’s much faster to do that without physical media until you’re sure that you’ve got it right.

First create a drive image:

Save the following into a script called qemu.sh

to test the ISO. If your target system will have SATA drives, you will need to build an alternate kickstart configuration file that references /dev/hda instead of /dev/sda, because qemu doesn’t support simulated SATA drives. This is when it is helpful to have a ks directory to hold multiple configuration file

Running the kickstart

When the system (virtual or physical) boots up, you’ll see your standard CentOS installation prompt. Rather than just hitting Enter to install, you type

If you chose to use some other name for your kickstart config file, replace ks.cfg with the name of your configuration file. You may choose to name your configuration files based on hostname or server class. If you have to use a test configuration file to get around the SATA limitations of qemu, you may call that file test.cfg or something similar.

Your installation should proceed automatically.

Now you have a working custom kickstart disc. To really take advantage of the power of kickstart, you’ll most likely need a custom postinstallation script to configure the system according to your specs. We’ll cover that in the next installment in this series.

part 1 · part 2 · part 4

Leave a comment

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