Product SiteDocumentation Site

2.6. Kickstart

System kickstarting is essential part of automated installation and efficient system provisioning. PXE combined with remote hardware management provides fully automated solution for kickstarting. However, parts of the network might not have PXE/DHCP functionality available so also CD/USB booting might be needed in some cases. The following sections provide step by step instructions on how to create customized boot images for kickstarting clients with CD/PXE/USB using standard Linux utilities from the syslinux package. Some of the steps (beginning with #) expects that they are run either with sudo or as root. Appendix C provides an example of boot menus for different kickstart targets that can be interactively selected when provisioning a system.

2.6.1. Preparing Custom Boot Media

First, locate the standard RHEL CD boot image boot.iso, create work directories for different boot images, and populate them with RHEL boot files:
mkdir -p temp cd/isolinux pxe/pxelinux.cfg usb/extlinux usb/temp
mount -o loop boot.iso temp
cp -a temp/isolinux/* cd/isolinux/
cp -a temp/isolinux/* pxe/
cp -a temp/isolinux/* usb/extlinux/
umount temp
chmod -R u+rw cd pxe usb
Follow the instructions below to create needed boot images.

2.6.2. Creating CD Boot Media

Creating bootable CD image can done with the following commands after the earlier preparations (note that the backslash "\" represents a continuation of one line at the shell prompt):
cd ./cd
cp -p /usr/lib/syslinux/menu.c32 isolinux
vi isolinux/isolinux.cfg
mkisofs -o ./custom-boot.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
  -boot-load-size 4 -boot-info-table -J -l -r -T -v -V "Custom RHEL Boot" .
Customize any boot parameters and targets in isolinux.cfg as needed for CD booting.

2.6.3. Preparing PXE Boot Directory

Creating a directory structure suitable for PXE booting can be done with the following commands after the previous preparations:
cd ../pxe
cp -p /usr/lib/syslinux/menu.c32 .
mv isolinux.cfg pxelinux.cfg/default
rm -f isolinux.bin TRANS.TBL
vi pxelinux.cfg/default
cp -p /usr/lib/syslinux/pxelinux.0 .
Customize any boot parameters and targets in pxelinux.cfg/default as needed for PXE booting.

2.6.4. Creating USB Boot Media

Creating bootable USB image can done with the following commands after the preparations above. Be extremely careful when carrying out these command as root (required for most critical parts) since they access device files and may irrecoverably damage your system! The example below uses /dev/loop0 for mounting, make sure you use the device which the command losetup -f prints.
cd ../usb
cp -p /usr/lib/syslinux/menu.c32 extlinux/
mv extlinux/isolinux.cfg extlinux/extlinux.conf
rm -f extlinux/isolinux.bin extlinux/TRANS.TBL
vi extlinux/extlinux.conf
dd if=/dev/zero of=./custom-boot.img bs=1024 count=30000
losetup -f
losetup /dev/loop0 ./custom-boot.img
fdisk /dev/loop0
Under fdisk, create one primary bootable partition by following the sequence of keypress commands entered within the fdisk interface:
n, p, 1, Enter, Enter, a, 1, p, w
Now, finish the process:
dd if=/usr/lib/syslinux/mbr.bin of=/dev/loop0
kpartx -av /dev/loop0
mkfs.ext2 -m 0 -L "Custom RHEL Boot" /dev/mapper/loop0p1
mount /dev/mapper/loop0p1 temp
rm -rf temp/lost+found
cp -a extlinux/* temp/
extlinux temp
umount temp
kpartx -dv /dev/loop0
losetup -d /dev/loop0
sync
Customize the boot targets and boot parameters in extlinux.conf as needed for USB booting. To transfer the image to a USB stick, insert the stick into your computer, check from dmesg output its device name (/dev/sdb in the example below), unmount it, and transfer the image:
umount /dev/sdb
dd if=./custom-boot.img of=/dev/sdb

2.6.5. Kickstart Boot Menu Example

The following files, when placed in the same directory as the menu helper program menu.c32 will present a boot menu which can be interactively navigated and edited byusing the arrow keys and the tabulator.
Main Menu
  DEFAULT menu.c32
  MENU TITLE Red Hat Enterprise Linux Installation
  TIMEOUT 100
  ALLOWOPTIONS 0
  NOESCAPE 1
  PROMPT 0
  MENU MASTER PASSWD password
  LABEL RHEL
   MENU LABEL TS 1.0 RHEL 5.4 x86_64
   KERNEL menu.c32
   APPEND rhel5.cfg
  # ISO/EXTLINUX
  LABEL LOCAL
   MENU LABEL Boot from local hard disk
   LOCALBOOT 0
  # PXELINUX
  # LABEL LOCAL
  # MENU LABEL Boot from local hard disk
  # KERNEL chain.c32
  # APPEND hd0 0