Using Kickstart

Review Chapter 2, Installing Red Hat Linux, pp. 41-46

Automating Installations

When rolling out multiple Red Hat installations, you can use a system similar to using Difference Files in Windows. As in this type of multiple installation in Windows, you start by building one machine and using it as a template for the rest.

The key to this is the kickstart file, which will be named ks.cfg. While you can build this file yourself, you should use the one Red Had leaves for you instead, at /root/anaconda-ks.cfg (in the root home folder, not the root of the file system). Rename this file to ks.cfg and you’re ready to start.

Note that you can get more information on this process from the Red Hat Linux Configuration Guide, available at redhat.com or any mirror site.

You must provide answers to all items, or the installation will stop until you or a user provides the answers. As always, use the text editor of your choice, and like any Bash script file, the character “#” indicates a comment line.

 

ks.cfg

# Kickstart file automatically generated by anaconda.
install
cdrom
lang en_US.UTF-8
langsupport –default=en_US.UTF-8 en_US.UTF-8 en_US en en_US.UTF-8 en_US en
keyboard us
xconfig –card “S3 Trio64 (generic)” –videoram 4096 –hsync 31.5-37.9 –vsync 50-70 –resolution 800×600 –depth 16 –startxonboot –defaultdesktop gnome
network –device eth0 –bootproto dhcp –hostname vFedora4
rootpw –iscrypted $1$Yvz632B.$375eW3XjP8ih1WFTeW8O./
firewall –disabled
selinux –permissive
authconfig –enableshadow –enablemd5
timezone America/Shiprock
bootloader –location=mbr –driveorder=hda –append=”rhgb quiet”
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart –all
#part /boot –fstype ext3 –size=100 –asprimary
#part swap –size=384
#part / –fstype ext3 –size=100 –grow –asprimary
%packages
@ office
@ mysql
@ editors
@ system-tools
@ gnome-desktop
@ dialup
@ ftp-server
@ network-server
@ games
@ smb-server
@ base-x
@ graphics
@ web-server
@ printing
@ kde-desktop
@ server-cfg
@ admin-tools
@ graphical-internet
kernel
grub
e2fsprogs
%post

 

Modifying ks.cfg

You must log in as root (bad idea) or command:

su –

Now, line 1 (line numbers exclude comments): install or upgrade?

Generally, you’ll want install. If you choose upgrade, you need only specify

  • language
  • install method
  • install device
  • keyboard
  • boot loader

Subsequent lines:

cdrom #installation device
lang en_US.UTF-8 #default language
langsupport –default=en_US.UTF-8 en_US.UTF-8 en_US en en_US.UTF-8 en_US en #supported languages
keyboard us #keyboard type
xconfig –card “S3 Trio64 (generic)” –videoram 4096 –hsync 31.5-37.9 –vsync 50-70 –resolution 800×600 –depth 16 –startxonboot –defaultdesktop gnome #THIS ONE SAVES YOU A LOT OF WORK – but your video card must be the same on each computer
network –device eth0 –bootproto dhcp –hostname vFedora4 #Notice that each computer will initially have the same host name, so DON’T BOOT WITH A LIVE NETWORK CONNECTION.
rootpw –iscrypted $1$Yvz632B.$375eW3XjP8ih1WFTeW8O./ #encrypted password
firewall –disabled #firewall
selinux –permissive #secure Linux or not?
authconfig –enableshadow –enablemd5 #use a shadow password file, and use MD5 hashing
timezone America/Shiprock #time zone
bootloader –location=mbr –driveorder=hda –append=”rhgb quiet” #bootloader: Grub (Red Hat Grub Bootloader) by default
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#Notice that you must un-comment these lines if you want to want to partition.
#clearpart –all
#part /boot –fstype ext3 –size=100 –asprimary
#part swap –size=384
#part / –fstype ext3 –size=100 –grow –asprimary

 

Specifying Packages in ks.cfg

Let your initial installation take care of this messy business:

%packages
@ office
@ mysql
@ editors
@ system-tools
@ gnome-desktop
@ dialup
@ ftp-server
@ network-server
@ games
@ smb-server
@ base-x
@ graphics
@ web-server
@ printing
@ kde-desktop
@ server-cfg
@ admin-tools
@ graphical-internet
kernel #yes, we want the kernel, but it is possible to disinclude it
grub #default boot loader
e2fsprogs #ext2 filesystem management programs
%post

 

Where To Put ks.cfg

  • Format a floppy disk ext2 or ext3:

    mkfs -t ext3 /dev/fd0

    then mount it and copy the file

  • On a local hard drive (which is a trick if you’re partitioning), which must be a Linux (usually ext3) or a shared Windows partition (VFAT)
  • On a network share, which requires a connection command:

    smbclient //192.168.2.136/shared -U someuser #for a Windows (Samba) share

Booting And Installing

The “easy” way (which quickly becomes a pain) is to

  • boot from the Red Hat CD
  • when you reach the command prompt, QUICKLY insert the ks.cfg floppy
  • then you’ll get the
    boot:
    prompt
  • SWIFTLY now, type:
    linux ks=file:fd0/ks.cfg
  • swap CDs when the installation requires

Try this three times, quickly, and see how often this gets tricky.

Instead, try

  • downloading the DVD image,
  • putting it on a network share,
  • mounting the ISO on the server:
    mount -o loop -t iso9660 redhat.iso /mnt/isoimage/
  • specify that mount in the ks.cfg file; instead of the line:
    cdrom
    use:
    /mnt/isoimage/
  • then, at the boot: prompt, type:
    ks:nfs:servername:fullpath #for an NFS server
    or
    ks=http://servername/path #for a web-based installation
    or even
    ks=hd:device #for a local or mounted hard drive; you’ll need to specify hd0, or the correct hard drive