Back to the main page

RedHat EL 5.8 kickstart network installation

This is automated way to install RHEL 5.8 with providing a file that has answers needed for an installation. The file can be placed on CDROM and other locations, here is example with placing a file on the network, on a NFS server.

For example, get the ISO of RHEL 5.8 and mount it.
{host}/# mount -r -t iso9660 -o loop -v /.0/iso/rhel_5.8/rhel-server-5.8-i386-dvd.iso /mnt

Copy the install-tree to /.0/kickstart/rhel-5.8 and create /.0/kickstart/ks-conf-files/ where needed kickstart file is placed.

The install server is also NFS one, have the file /etc/exports with the lines:

/.0/kickstart/ks-conf-files *(ro)
/.0/kickstart/rhel-5.8 *(ro)

Export the location for NFS.
{host}/# exportfs -av
exporting *:/.0/kickstart/ks-conf-files
exporting *:/.0/kickstart/rhel-5.8

{host}/# exportfs -v
/.0/kickstart/ks-conf-files
                (ro,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
/.0/kickstart/rhel-5.8
                (ro,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)

Have the DHCP servuce running with /etc/dhcpd.conf file something lise:
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
ddns-update-style none;
subnet 192.168.28.0 netmask 255.255.255.0 {
	authoritative;
	# --- default gateway
        option routers                  192.168.28.1;
        option subnet-mask              255.255.255.0;
        option nis-domain               "domain.com";
        option domain-name              "domain.com";
        option domain-name-servers      198.49.x.x;

        range dynamic-bootp 192.168.28.221 192.168.28.221;
        default-lease-time 21600;
        max-lease-time 43200;
        #allow booting;
        #allow bootp;
        one-lease-per-client on;

	# unixlab-8 gets same IP all the time
        host unixlab-8 {
                option host-name "unixlab-8.domain.com";
                hardware ethernet 00:14:4F:01:7E:E8;
                fixed-address 192.168.28.221;
                filename "linux-install/pxelinux.0";
                next-server 192.168.28.220;
        }
}

Check dhcp service is running:
{host}/# service dhcpd status
dhcpd (pid  3278) is running...

Have TFTP server running:
{host}/# chkconfig --list tftp
tftp            on
{host}/# cat /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        disable = no
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -v -s /tftpboot
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

Let's now configure Operating System descriptions to be used for PXE boot files.
The command creates a sub-directory RHEL5.8 in the /tftpboot/linux-install/ and copy linux kernel (vmlinuz) and ram disk (initrd.img), normally located in images/pxeboot directory of the installation tree (defined with -L).
The -K defines NFS location of directory with kickstart file.
The initrd.img (initial ram disk is part of memory that can be formatted/mounted like block device) is used for loading a temporary root file system during kernel (vmlinuz) boot process.
{host}/# pxeos -a -i "RHEL5.8" -p NFS -D 0 -s 192.168.28.220 -L /.0/kickstart/rhel-5.8 -K nfs:192.168.28.220:/.0/kickstart/ks-conf-files RHEL5.8

{host}/# pxeos -l
RHEL5.8
        Description:    RHEL5.8
        Protocol:       NFS
        isDiskless:     False
        Server:         192.168.28.220
        Location:       /.0/kickstart/rhel-5.8

Let's configure PXE boot files:
{host}/# pxeboot -a -K nfs:192.168.28.220:/.0/kickstart/ks-conf-files/unixlab-8-ks.cfg -O RHEL5.8 unixlab-8

{host}/# pxeboot -l
pxelinux client: 192.168.28.221
default RHEL5.8
label RHEL5.8
    kernel RHEL5.8/vmlinuz
    append initrd=RHEL5.8/initrd.img  ramdisk_size=14430 method=nfs:192.168.28.220:/.0/kickstart/rhel-5.8 ip=dhcp

The file /tftpboot/linux-install/pxelinux.cfg/C0A81CDD (host to be installed IP in HEX) is created with the content:
default RHEL5.8
label RHEL5.8
    kernel RHEL5.8/vmlinuz
    append initrd=RHEL5.8/initrd.img  ramdisk_size=14430 ks=nfs:192.168.28.220:/.0/kickstart/ks-conf-files/unixlab-8-ks.cfg

Make sure TFTP is running on the server and now boot the machine where you want to install rhel-5.8 from the network.





And some syslog messages on the server:
dhcpd: DHCPDISCOVER from 00:14:4f:01:7e:e8 via eth0
dhcpd: DHCPOFFER on 192.168.28.221 to 00:14:4f:01:7e:e8 via eth0
dhcpd: DHCPREQUEST for 192.168.28.221 (192.168.28.220) from 00:14:4f:01:7e:e8 via eth0
dhcpd: DHCPACK on 192.168.28.221 to 00:14:4f:01:7e:e8 via eth0
in.tftpd: RRQ from 192.168.28.221 filename linux-install/pxelinux.0
in.tftpd: tftp: client does not accept options
in.tftpd: RRQ from 192.168.28.221 filename linux-install/pxelinux.0
in.tftpd: RRQ from 192.168.28.221 filename linux-install/pxelinux.cfg/01-00-14-4f-01-7e-e8
in.tftpd: RRQ from 192.168.28.221 filename linux-install/pxelinux.cfg/C0A81CDD
in.tftpd: RRQ from 192.168.28.221 filename linux-install/RHEL5.8/vmlinuz
in.tftpd: RRQ from 192.168.28.221 filename linux-install/RHEL5.8/initrd.img
dhcpd: DHCPDISCOVER from 00:14:4f:01:7e:e8 via eth0
dhcpd: DHCPOFFER on 192.168.28.221 to 00:14:4f:01:7e:e8 via eth0
dhcpd: DHCPREQUEST for 192.168.28.221 (192.168.28.220) from 00:14:4f:01:7e:e8 via eth0
dhcpd: DHCPACK on 192.168.28.221 to 00:14:4f:01:7e:e8 via eth0
mountd: authenticated mount request from 192.168.28.221:987 for /.0/kickstart/ks-conf-files (/.0/kickstart/ks-conf-files)
mountd: authenticated mount request from 192.168.28.221:990 for /.0/kickstart/rhel-5.8 (/.0/kickstart/rhel-5.8)

And example of kickstart file:
# install not update
install

# define type of installation
#cdrom
nfs --server=192.168.28.220 --dir=/.0/kickstart/rhel-5.8

# perform installation in text mode, default is GUI mode
text
# required, set language during installation
lang en_US.UTF-8
#set languages installed on system
langsupport en_US.UTF-8
# required, set keyboard type
keyboard us

# network info used during installation and for installed system
network --device eth0 --bootproto static --ip 192.168.28.221 --netmask 255.255.255.0 --gateway 192.168.28.1 --nameserver 198.49.180.149 --hostname unixlab-8

# encrypted root password
rootpw --iscrypted $1$KBf2ShFQ$P3Sih6cgnpMcTij1YHcmh0

# disable firewall - iptables
#firewall --enabled --port=22:tcp
firewall --disabled

# authconfig setup authentication options for system
authconfig --enableshadow --enablemd5

# Security Enhanced Linux, enable with default target policy
selinux --enforcing

# set timezone
timezone America/Los_Angeles

# bootloader define how GRUB bootloader should be installed
bootloader --location=mbr --driveorder=sda,sdb

# 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 --initlabel

#part / --fstype ext3 --size=4500 --ondisk=sda --asprimary
#part /var --fstype ext3 --size=4500 --ondisk=sda
#part /.0 --fstype ext3 --size=4500 --ondisk=sda
#part swap --recommended
#part swap --size=4500 --ondisk=sda

# raid1
part raid.a1 --size 4500 --asprimary --ondisk=sda
part raid.a2 --size 4500 --asprimary --ondisk=sda
part raid.a3 --size 4500 --asprimary --ondisk=sda
part raid.a4 --size 1 --grow --ondisk=sda

part raid.b1 --size 4500 --asprimary --ondisk=sdb
part raid.b2 --size 4500 --asprimary --ondisk=sdb
part raid.b3 --size 4500 --asprimary --ondisk=sdb
part raid.b4 --size 1 --grow --ondisk=sdb

raid / --fstype ext3 --device md1 --level=RAID1 raid.a1 raid.b1
raid swap --fstype swap --device md2 --level=RAID1 raid.a2 raid.b2
raid /var --fstype ext3 --device md3 --level=RAID1 raid.a3 raid.b3
raid /.0 --fstype ext3 --device md4 --level=RAID1 raid.a4 raid.b4

# packages to be installed
# @ is group of packages
%packages
@admin-tools
@base
@core
@dns-server
@development-libs
@development-tools
#@dialup
@editors
@java
@legacy-software-support
@mail-server
@network-server
@server-cfg
@system-tools
@text-internet
kexec-tools
fipscheck
device-mapper-multipath
sgpio
perl-Convert-ASN1
python-dmidecode
imake
emacs
dnsmasq
audit
dhcp

# pre-installation script
%pre

#!/bin/sh
# simple example
sleep 5
/bin/echo This is PRE-installation script that does nothing.

# post-installation script
%post

# simple example
/bin/sleep 5
/bin/echo "This is POST-installation script that does nothing."
/bin/echo STOP sendmail 
/sbin/service sendmail stop
/bin/echo START nfs 
/sbin/service nfs start



Back to the main page