Using kickstart Installation


Using kickstart Installation

If you need to install Red Hat Linux on many PCs, you need a way to automate the process so that you do not have to respond to the GUI installer prompts for each PC. kickstart is the answer to this need. It’s an automated installation method that enables you to install Red Hat Linux with very little interaction from you.

The idea behind kickstart is to create a text file with all the installation options and then “kick start” the installation by booting and then providing the kickstart file as input.

Starting a kickstart Installation

Setting aside for the moment how to prepare a kickstart file, I want to briefly explain how you can start a kickstart installation. The common use of kickstart installation is to place the Red Hat Linux ISO images on a server on the network and then perform kickstart installations at all the PCs. Let’s assume that you have the ISO images on a Web server and you want to install over the network using the HTTP installation method, but do this under the control of a kickstart file. Here’s what you would do:

  1. Prepare a boot disk with the bootdisk.img file (located in the images directory of the first Red Hat Linux CD-ROM).

  2. Prepare a network driver disk with the drvnet.img file.

  3. Place the ISO images and the kickstart file on the Web server and make note of the directory where the kickstart file is located.

  4. Boot the PC using the boot disk. At the boot prompt, type the following command:

    linux ks=http://<server>/<pathname of kickstart file>

    where <server> stands for the name of the Web server and <pathname of kickstart file> is the complete pathname of the kickstart file. Thus, if the server is mycompany.com and the kickstart file’s pathname is /redhat8/ks.cfg, then you type the following at the boot prompt:

    linux ks=http://mycompany.com/redhat8/ks.cfg

After that the installation should proceed under the control of the kickstart file.

If the kickstart file is on an NFS server, all you have to do is specify the kickstart file appropriately. The kickstart syntax for NFS is

linux ks=nfs:<server>:/<path>

Thus, if the NFS server is someserver.com and the location of the kickstart file is /somedir/ks.cfg, then you type the following command at the boot prompt:

linux ks=nfs:someserver.com:/somedir/ks.cfg

You can also place a kickstart file named ks.cfg on a floppy (type mcopy ks.cfg a: to copy the file to a floppy), and then install it with the following command at the boot prompt:

linux ks=floppy

You can also use a very simple form of the kickstart installation command that looks like this:

linux ks

In this case, the installation program configures the Ethernet card using DHCP and then uses the bootServer item from the DHCP response as the NFS server from which to get the kickstart file. The name and location of the kickstart file depends on the bootfile specified by DHCP. If the DHCP server does not specify a bootfile, the installler tries to read the file /kickstart/A.B.C.D-kickstart, where A.B.C.D is the numeric IP address of the PC on which you are installing Red Hat Linux.

Preparing the kickstart File

One way to get a kickstart file is to perform the installation on one PC. The Red Hat installer saves the installation options in the /root/anaconda-ks.cfg kickstart file. You can then use this kickstart file to repeat the installation on other PCs. You can also use this kickstart file as a starting point and edit it to create a custom kickstart file suitable for your situation.

Here’s a typical anaconda-generated kickstart file:

# Kickstart file automatically generated by anaconda.
install
lang en_US.UTF-8
langsupport --default en_US.UTF-8 en_US.UTF-8
keyboard us
mouse generic3ps/2 --device psaux
xconfig --card "nVidia GeForce 2 Go" --videoram 16384 --hsync 31.5-48.5 --vsync
40-70 --resolution 1024x768 --depth 24 --startxonboot  --defaultdesktop gnome
network --device eth0 --bootproto dhcp
rootpw --iscrypted $1$7oGAOtge$Q7PC0e2sIRSwRouqxlyMS.
firewall --disabled
authconfig --enableshadow --enablemd5
timezone America/New_York
bootloader --location=mbr
... other kickstart options deleted ...

%packages
@ Administration Tools
@ GNOME Desktop Environment
@ Office/Productivity
@ Printing Support
.... other package groups...
@ X Window System
gnome-audio
tk
... other individual packages...
xmms
firstboot

%post

As you can see, the file starts with a long list of kickstart options that essentially mirrors the installation steps that you normally go through when you install Red Hat Linux interactively. After the kickstart options comes a %packages section that lists the package groups and individual packages to install. Finally, you see a %post section that contains any commands to execute after the installation is complete. For example, you could add commands in the %post section to add one or more user accounts.

As this example illustrates, a kickstart file has the following sections, in the exact order shown:

  • Command section—This section lists all the kickstart options that control various aspects of the installation

  • %packages section—This section lists the package groups (with names that have an @ prefix) and individual package names.

  • %pre and %post sections—These two sections are optional, and they can appear in any order.

The command section of the kickstart file contains, at minimum, all the required options shown in Table 2-4. That table shows all the kickstart options and briefly describes each option.

Table 2-4: kickstart Options

Option

Optional (O) or Required (R)

Description

autostep

O

Similar to interactive, except that it goes to the next screen for you. It is used mostly for debugging.

auth or authconfig

R

Specifies the authentication options. Use one or more of following arguments after this option:

  

enablemd5 (use MD5 encryption for passwords)

  

enablenis (turns on NIS support)

  

nisdomain=<nisdomain> (specifies NIS domain name)

  

—nisserver=<nisserver> (specifies the NIS server name)

  

—useshadow or —enableshadow (turns on shadow passwords)

  

—enableldap (turns on LDAP support in /etc/nsswitch.conf and requires the nss_ldap package)

  

—enableldapauth (enables LDAP as an authentication method)

  

—ldapserver=<LDAPserver> (specifies the LDAP server name)

  

—ldapbasedn=<LDAP-DN> (specifies LDAP distinguished name)

  

—enableldaptls (uses transport layer security during LDAP lookups)

  

—enablekrb5 (turns on Kerberos 5 for authenticating users)

  

—krb5realm=<KRBrealm> (specifies the Kerberos realm)

  

—krb5kdc=<KDCserver> (specifies the Key Distribution Center)

  

—krb5adminserver=<Kadminserver> (specifies the server running kadmind)

  

—enablehesiod (enables Hesiod support for looking up user information)

  

—hesiodlhs (specifies the Hesiod left-hand side)

  

—hesiodrhs (specifies the Hesiod right-hand side)

  

—enablesmbauth (enables authentication of users by an SMB server)

  

—smbservers=<SMBservers> (specifies the servers to use for SMB authentication)

  

—smbworkgroup=<WkGrpName> (specifies the workgroup name)

  

—enablecache (enables the nscd service that caches user information)

bootloader

R

Specifies where the boot loader is installed and, optionally, which boot loader to install. Use one or more of following arguments after this option:

  

—append=<kernel-params> (specifies kernel parameters)

  

—location=[mbr|partition|none] (tells where to write the boot loader,: one of mbr, part, or none)

  

—password=<GRUB-passwd> (specifies the GRUB password)

  

—md5pass=<encrypted-GRUB-pass> (encrypted GRUB password)

  

—useLilo (forces installation of LILO instead of GRUB)

  

—lba32 (when using LILO, force use of LBA32 mode of hard disk access)

  

—upgrade (upgrades existing boot loader configuration)

clearpart

O

Removes partitions from the system before creating new partitions. Use one or more of following arguments after this option:

  

—linux (erases all existing Linux partitions)

  

—all (erases all existing partitions)

  

—drives=<drivenames> (specifies which drives to clear partitions from)

  

—initlabel (initializes the disk label to the default for PC’s architecture)

device <type> <moduleName>

O

Instructs installer to load extra device driver modules. Use the following arguments: —opts=<options>

  

<type> (either scsi or eth—for a SCSI or Ethernet card)

  

<moduleName> (the name of the driver module)

  

—opts=<options> (options for the module, these depend on the driver)

deviceprobe

O

Probes the PCI bus for devices and loads modules for all the devices found (assuming that a module is available for the device)

driverdisk

O

Instructs the installer to look for driver disks in the specified disk partition. Use the following arguments:

  

<partition> (disk partition containing the driver disk contents)

  

—type=<fstype> (optional argument that specifies file system type: vfat, ext2, or ext3)

firewall

O

Configures the firewall based on the arguments:

  

<securitylevel> (one of —high, —medium, or —disabled)

  

—trust=<device> (trusted network device such as eth0)

  

<incoming> (one of —dhcp, —ssh, —telnet, —smtp, —http, —ftp)

  

—port=<portnum:protocol> (ports allowed through firewall)

install

O

Indicates that you want to do a fresh install. Specify the install method with one of the following arguments:

  

cdrom (installs from the first CD-ROM drive)

  

harddrive —partition=<part> —dir=<dirname> (installs from a directory on hard disk partition)

  

nfs —server=<servername> —dir=<dir> (installs from a directory on the NFS server)

  

url —url http://<server>/<dir> (installs from a Web server)

  

url —url ftp://<username>:<password>@ <server>/<dir> (installs from a FTP server)

interactive

O

Allows you to view and modify options as kickstart install progresses

keyboard

R

Sets the keyboard type. Here is the list of available keyboards on i386, Itanium, and Alpha machines: be-latin1, be-latin2, bg, br-abnt2, cf, cz-lat2, cz-us-qwertz, de, de-latin1, de-latin1-nodeadkeys, dk, dk-latin1, dvorak, es, et, fi, i-latin1, fr, fr-latin0, fr-latin1, fr-pc, fr_CH, fr_CH-latin1, gr, hu, hu101, is-latin1, it, it-ibm, it2, jp106, no, no-latin1, pl, pt-latin1, ro, ru, ru-cp1251, ru-ms, ru1, ru2, ru_win, se-latin1, sg, sg-latin1, sk-qwerty, slovene, speakup, speakup-lt, trq, ua, uk, us

lang

R

Sets the language to use during installation. Valid language codes are cs_CZ, da_DK, en_US, fr_FR, de_DE, is_IS, it_IT, ja_JP.eucJP, ko_KR.eucKR, no_NO, pt_PT, ru_RU.koi8r, sl_SI, es_ES, sv_SE, uk_UA, zh_CN.GB18030, zh_TW.Big5

langsupport

R

Sets the languages to install on the system. Use the same language codes as the ones for the lang option. If you install more than one language, indicate the default with the following argument:

  

—default=<lang> (sets default language)

logvol

O

Creates a logical volume for Logical Volume Management (LVM). Provide the following arguments:

  

<mountpoint> (name of directory where volume is mounted)

  

—vgname=<groupname> (name of volume group)

  

—size=<size> (size in megabytes)

  

—name=<volname> (name of logical volume)

mouse

R

Specifies the mouse type and configures it. Use the following arguments:

  

—device=<devname> (name of mouse device such as psaux or ttyS0)

  

—emulthree (enable emulation of a three-button mouse)

  

<mousetype> (specifies mouse type such as genericps/2 or generic3ps/2)

network

O

Configures the local area network information. For installations over network, the installation uses the first Ethernet card (eth0) and configures is dynamically using DHCP. Use the following arguments to configure network:

  

—bootproto=<protocol> (one of dhcp, bootp, or static)

  

—device=<netdevice> (Ethernet device name such as eth0 or eth1)

  

—ip=<IPaddress> (the IP address for static addressing)

  

—netmask=<Netmask> (for static addressing)

  

—gateway=<gateway_IP> (default gateway IP address)

  

—nameserver=<nameserver_IP> (primacy nameserver’s IP address)

  

—nodns (do not configure any DNS server)

  

—hostname=<hostname> (hostname of the system)

part or partition

R

Creates a partition on the hard drive. Use the following arguments to specify details:

  

<mntpoint> (the directory where the partition is mounted or the keyword swap for swap partition)

  

—recommended (use with swap to size the partition automatically)

  

raid.<id> (to use partition in a software RAID device)

  

pv.<id> (to use partition in a logical volume)

  

—size=<megabytes> (size in megabytes)

  

—grow (causes partition to grow up to available space)

  

—maxsize=<maxMB> (maximum size in megabytes)

  

—noformat (do not format partition)

  

—onpart=<partname> (puts partition on already existing device)

  

—usepart=<partname> (puts partition on already existing device)

  

—ondisk=<diskname> (creates partition on the specified disk)

  

—ondrive=<diskname> (creates partition on the specified disk)

  

—asprimary (creates a primary partition)

  

—bytes-per-inode=<numbytes> (number of bytes per inode on the filesystem)

  

—fstype=<filesystem> (name of file system—one of ext2, ext3, swap, or vfat)

  

—start=<startCylinder> (starting cylinder of partition)

  

—end=<endCylinder> (ending cylinder of partition)

  

—badblocks (checks partition for bad blocks)

raid

O

Creates a software RAID device. Use the following arguments:

  

<mntpoint> (the directory where the RAID device is mounted)

  

—level=<RAID_level> (the RAID level to use—0, 1, or 5)

  

—device=<devname> (name of RAID device such as md0 or md1)

  

—spares=<number> (number of spare drives allocated for the RAID array)

  

—fstype=<filesystemType> (filesystem type—one of ext2, ext3, swap, or vfat)

  

—noformat (does not format the RAID array)

reboot

O

Reboots after the installation is complete

rootpw

R

Sets the system’s root password. Use the following arguments:

  

—iscrypted (password is already encrypted)

  

<password> (the encrypted root password)

skipx

O

Skips configuration of X Window System.

text

O

Performs the installation in text mode (instead of the default graphical mode).

timezone

R

Sets the system time zone. Use the following arguments:

  

—utc (indicates that hardware clock is set to UTC—Greenwich Mean Time)

  

<timezone> (the time zone name such as America/New_York or EST5EDT)

upgrade

O

Upgrades an existing system rather than installing a fresh system

xconfig

O

Configures the X Window System. Use the following arguments:

  

—noprobe (does not probe the monitor)

  

—card=<videcardName> (name of video card from list in /usr/share/hwdata/Cards)

  

—videoram=<kilobytes> (amount of video RAM in kilobytes)

  

—monitor=<monitorName> (name of monitor from list in /usr/share/hwdata/MonitorsDB)

  

—hsync=<HSyncRange> (range of horizontal synchronization frequencies in kHz such as —hsync 31.5-69.0)

  

—vsync=<VSyncRange> (range of vertical synchronization frequencies in Hz such as —vsync 55-120)

  

—defaultdesktop=<DesktopName> (GNOME or KDE)

  

—startxonboot (provides a graphical login screen)

  

—resolution=<HHHxVVV> (default resolution in terms horizontal and vertical pixels such as 640x480 or 1024x768)

  

—depth=<defaultDepthBits> (default color depth—one of 8, 16, 24, or 32)

volgroup

O

Creates a Logical Volume Management (LVM) group. Use following arguments:

  

<name> (name of logical volume group)

  

<partition> (partition to use)

zerombr

O

Initializes any invalid partition tables found on disks. Use the following argument:

  

yes (destroy disks with invalid partition tables)

%include

O

Includes the content of another file into this kickstart file. Use the following arguments:

  

<pathname> (the file to include)

The package group names listed in the %package section are defined in the RedHat/base/comps.xml file on the first Red Hat Linux CD-ROM. The comps.xml file uses XML to define the package database. Each package group contains one or more packages. The comps.xml file also defines the dependencies for each package—the other packages that a package needs in order to work properly.

The %pre section includes commands to be executed immediately after the kickstart file has been processed but before any installation steps are performed. In the %pre section, you can place a shell script to perform any preparatory tasks that have to be performed before installation can begin.

The %post section contains the commands to be executed after installation complete. In this section, you can place commands to turn services on or off and add user accounts.

Insider Insight 

If you have a working Red Hat Linux system with a GUI desktop, you can use a GUI tool, called Kickstart Configurator, to create the kickstart file. To use the tool, select Main Menu>System Tools>Kickstart. You can also start the tool by typing the redhat-config-kickstart command in a terminal window.