wiki:KickStart
Last modified 6 years ago Last modified on 08/11/11 09:34:53

We keep the installation tree for the latest version of Red Hat Enterprise Linux for network installs with a generic kickstart file that sets keyboard language, network install URL, basic server packages, and other local settings. Kickstart installs are usually much faster than CD installs since you can specify settings beforehand. You can find more info by Searching RHEL Manuals and mailing lists. Ubuntu Linux also supports kickstart installation (via a kickseed package that translates into the native Debian preseed format).

Making the install tree from ISO files

cd $MY_EL_DIR
VER=6
ARCH=x86_64
mount -o loop -t iso9660 /ISO/rhel-server-${VER}*-$ARCH-dvd.iso /mnt/
if [ -d /ISO/el${VER}/$ARCH ]; then
 mv /ISO/el${VER}/$ARCH /ISO/el${VER}/old
fi
mkdir -p /ISO/el${VER}/$ARCH/
nohup /bin/cp -vr /mnt/ /ISO/el${VER}/$ARCH/disc1 &
umount /mnt

If you already have linux on your system, the easiest way to start a kickstart install is from your bootloader. If it's a reinstall, you can use the script at http://staff.washington.edu/joshuadf/ks/pxeboot.sh or just copy the files from images/pxeboot/ on the DVD and put them in /boot on your system; here is an example grub section:

title kickstart install
        root (hd0,0)
        kernel /pxeboot/vmlinuz ks=http://staff.washington.edu/joshuadf/ks/dhcp.cfg ksdevice=link ramdisk=32768
        initrd /pxeboot/initrd.img 

To perform a kickstart install from CD, boot from the installation CD. At the boot: prompt, type "linux http://staff.washington.edu/joshuadf/ks/dhcp.cfg" to use the generic kickstart file.

Alternatively, before installing you may copy the generic file to something like servername.cfg, add in your specific preferences, and point the installer to that file. For more information about the kickstart files, see the Red Hat manual section about Kickstart Installations. And you can get really fancy using pre sections.

Some kickstart features are also available for Ubuntu Automatic Installation. With Grub2 (used in Ubuntu), you need to create a file such as /etc/grub.d/06-pxeboot with contents like the below and then run update-grub:

echo "Adding pxeboot" >&2
cat << EOF
menuentry "Ubuntu pxeboot" {
        set root=(hd0,1)
        linux /boot/linux  ks=http://staff.washington.edu/joshuadf/ks/u1004.cfg
        initrd /boot/initrd.gz
}

EOF

GPT with BIOS

It is fairly easy to boot off of 2Tb+ drives in Red Hat EL6, though getting it to work is not obvious. For example, newer servers support UEFI but if you do a default Red Hat EL6 install on an 10G 64-bit Dell PowerEdge server you will get an MSDOS disk label (also note the older HardwareRaid PERC cards only support drives up to 2Tb).

The secret is that the disk label must be GPT (GUID Partition Table) which is not the default for BIOS-based x86 machines (Macs and Itanium use EFI/GPT). Once a GPT disk label exists the installer will use it. I'm not clear on precisely what's going on with grub, the MBR, etc but it works. I did find a utility "gdisk" aka "GPT fdisk" http://www.rodsbooks.com/gdisk/ which has lots of details about GPT.

Here are two ways to install with GPT as disk label on Red Hat EL6 on a BIOS-based server:

  1. In the graphical installer, before partitioning switch to a shell (Ctrl-Alt-F2) and run "parted /dev/sda" and "mklabel gpt". You can now proceed as normal in the install, including automated or customized partitioning, LVM, etc.
  1. Using kickstart, make sure you do NOT use "zerombr" or "clearpart --all" which recreate an MSDOS disk label ("clearpart --linux" is fine) and add something like this (the "dd" is only really necessary if you need to destroy an old disk label first):
%pre
DDEV=/dev/sda
dd if=/dev/zero of=/dev/$DDEV bs=512 count=64
parted -s /dev/$DDEV mklabel gpt

Unfortunately I did not have any luck getting GPT booting to work with Ubuntu 10.04, but I didn't try very hard. The installer seemed to always create a MSDOS label, and "parted" is not available on the Ubuntu 10.04 installer's shell, only "fdisk". Surely that will change soon with single 3Tb disks already on newegg, though perhaps EFI will become mainstream first. 2Tb disk limits are just one of many things like 32-bit Windows that I thought would be long gone by 2011.

The local default kickstart file

Here are more details about the local kickstart configuration file:

  • The kickstart file disables all network services to minimize security vulnerabilities. After performing the install, run yum -y upgrade to download all updates. To configure services that should run automatically after the first update, the kickstart creates this file that you can run with source /root/start-services:
    chkconfig ntpd on 
    chkconfig sshd on 
    chkconfig httpd on
    
    Note that this does not immediately start these services; to do that run init 3 or commands such as
    /etc/init.d/sshd start
    /etc/init.d/ntpd start
    
  • Kickstart also
    • disables SELinux since we have too many non-standard parts. It would certainly be worth developing a good policy for it, though.
  • installs a basic iptables firewall configuration
  • Kickstart does NOT start any services

Upgrades

To upgrade an installation, you can use the copy the generic kickstart file and change the install line to upgrade. You can even directly boot the installer using GRUB. Of course, you probably want to remove all the extra post-installation stuff.

Non-Kickstart Network Installations and Upgrades

Unfortunately, sometimes kickstart installations don't work, for example because of a driver or setup problem in anaconda (the Red Hat installer). If you find that kickstart isn't working, the best option is to do a network install. At the boot: prompt, type "linux askmethod" (or "linux text askmethod" for the faster text-mode installation). At the menu choose an HTTP install.

If this does not work and you can't find a network connectivity problem, you may need to just burn all the binary DVD and install that way. It is also possible to create custom install DVDs, see http://people.redhat.com/rkeech/custom-distro.txt

You can also use an install to create a kickstart file. After an install, the anaconda installer leaves a working kickstart file based on your install as /root/anaconda-ks.cfg. If you comment out any part of the kickstart file (i.e., partitioning information), the installer will ask you.

USB Boot ISO

UPDATE: you can actually dd the boot.iso to a USB key thanks to isohybrid. However you can still do the below if you want a smaller one.

For whatever reason Red Hat no longer provides a diskboot.img that can easily create a USB version of boot.iso, but we can create one ourselves:

# must be done on EL6 or Fedora equivalent to get latest syslinux
yum -y install syslinux

Now:

umount /mnt
# download rhel-server-6.1-x86_64-boot.iso or whatever as boot.iso
mount boot.iso /mnt -o loop,ro
cd /tmp/
mkdir pendrive
cd pendrive/
# can be smaller if you don't want the whole thing
dd if=/dev/zero of=diskboot.img bs=1M count=260
mkdosfs diskboot.img 
#mkdosfs 2.11 (12 Mar 2005)
syslinux diskboot.img 
mkdir mount
mount diskboot.img mount/ -o loop
cp -r /mnt/isolinux/* mount/
grep -v local mount/isolinux.cfg > mount/syslinux.cfg
rm -f mount/isolinux.∗
umount -f mount
rm -rf mount/
umount -f /mnt

You now have a diskboot.img version of whatever boot.iso you used.