PXE Installation

Red Hat allows you to install the OS over the network using NFS, FTP or HTTP. If the hardware supports PXE (Pre-execution Environment) the NIC card will send out a broadcast request for DHCP information. The DHCP server provides the client with a IP address and other network infomation such as the TFTP server address (which provides the files necessary to start the installation) and the location of the files on the TFTP server. This is possible because of PXELINUX, which is part of the syslinux package.

In order to setup a PXE installation the following must be carried out: Install the necessary packages

a)      Configure the network (NFS, FTP, HTTP) server to export the installation tree (redhat packages, etc)

b)       Configure the DHCP server

c)        Configure the files on the tftp server necessary for PXE booting

d)       Configure which hosts are allowed to boot from the PXE configuration

e)      Configure the Kickstart file

Boot and start the installation

Software Packages (required)

The following software packages are required

a)       tftp-server-*

b)       tftp-client-* (for testing)

c)       Dhcp-*

d)      xinetd-*

e)      system-config-netboot-* (supplies the prelinux.0 file)

Installation Tree

Assume the installation directory /export/kickstart , but this could be anything you like.

Basically create the directory and share the directory to the world, then copy the complete Linux/RHEL dvd or cdroms to this directory, once copied you should have something

similar to below

total 52

drwxr-xr-x 10 root root  4096 Oct  6 13:38 .

drwxr-xr-x  3 root root  4096 Oct  6 09:45 ..

drwxrwsr-x  4 root root  4096 Mar 15  2006 Linux

drwxrwsr-x  3 root root  4096 Mar 15  2006 figs

drwxrwsr-x  4 root root  4096 Mar 15  2006 images

drwxrwsr-x  2 root root  4096 Mar 15  2006 isolinux

drwxr-xr-x  2 root root  4096 Oct  6 14:00 ks            (this is where my kickstart files are held)

drwx——  2 root root 16384 Oct  6 09:47 lost+found

drwxrwsr-x  2 root root  4096 Mar 15  2006 repodata

drwxrwsr-x  2 root root  4096 Mar 15  2006 stylesheet-images

DHCP Installation

Once the DHCP package has been installed, a basic configuration file needs to be setup in /etc/dhcpd.conf, again this configuration file can be has advanced as you want it to be.


# DHCP Server Configuration file.

#   see /usr/share/doc/dhcp*/dhcpd.conf.sample

ddns-update-style ad-hoc;

deny unknown-clients;

not authoritative;

option domain-name              “example.com”;

option domain-name-servers      ???.???.???.???, ???.???.???.???;

option subnet-mask    ;

allow bootp;

allow booting;

option ip-forwarding    false;  # No IP forwarding

option mask-supplier    false;  # Don’t respond to ICMP Mask req

subnet netmask {

option routers;


group {

next-server;          # name of your TFTP server

filename “linux-install/pxelinux.0″;        # name of the bootloader program

host Linux {

hardware ethernet 00:00:26:95:B8:A4;




The above file will setup the host Linux (note the specific MAC address associated to the host Linux) and boot from the next-server (tftp server) using the pxelinux.0 boot file,

Which in turn will look for the pxe configuration boot file.

PXE Boot Configuration Files

The PXE boot configuration basically is setting up the /tftpboot directory to allow clients to download the PXE boot configuration script and allow access to the initial ram disk (initrd.msg) and the linux kernel (vmlinuz).

The tftpboot directory will contain the following directories and files

/tftpboot/linux-install/prelinux.0             This file is the PXE boot file and will be run immediately after the the client has connected to the tftp server.

/tftpboot/linux-install/msgs       This directory contains the boot messages/menus displayed when the client boots

/tftpboot/linux-install/pxelinux.cfg         This directory contains the PXE boot configuration scripts, normally named C0A80023 (ip address of host in HEX)

/tftpboot/linux-install/RHEL4     This directory is optional and is created when using the system-config-netboot or pxeos commands. It is used to hold kickstart scripts, linux

kernels and ram disks for specific installations.

Two commands are used to configure the tftpboot area pxeos and pxeboot

Using the command below will create a directory called RHEL4 and copy the necessary linux kernel and ram disk files (normally located in images/pxeboot directory of the

installation tree), we are also stating that we will use NFS to install the OS onto clients

# pxeos -a -i “<description>” -p NFS -D 0 -S <tftp IP addr> -K nfs:<kickstartserver>:/export/kickstart -L /export/kickstart RHEL4

-a            Specifies that an OS instance is being added to the PXE configuration

-i             Description of the OS instance

-p            Specify which protocol to use for the o/s installation (NFS, FTP, HTTP)

-D           Specify if client is diskless (0=network, 1=diskless)

-s            Provides the name of the NFS, FTP or HTTP server

-L            Provides the location of the installation tree (o/s rpms, etc)

-k            provide the specific kernel version of the server installation tree for booting

-K            provide the location of the kickstart file

os-identifier       OS identifier to keep different build seperate

The above command would have copied the linux kernel (vmlinuz) and ram disk (initrd.msg) to the /tftpboot/linux-install/RHEL4 directory and also created a blank kickstart

configuration file( i will be using my own kickstart file discussed later). Also the command would have created a pxe boot default file in the /tftpboot/linux-

install/pxelinux.cfg directory as below:

default local

timeout 100

prompt 1

display msgs/boot.msg

F1 msgs/boot.msg

F2 msgs/general.msg

F3 msgs/expert.msg

F4 msgs/param.msg

F5 msgs/rescue.msg

F7 msgs/snake.msg

label 0

localboot 1

label 1

kernel RHEL5/vmlinuz

append initrd=RHEL5/initrd.img ramdisk_size=5939 ks=nfs:

To setup specific pxe boot configuration files we use a command called pxeboot, this will override the above default boot configuration file

pxeboot -a -K <kickstart server> -O OS identifier <hostname>

-a            add a specific host

-K            location of kickstart file

-O           OS identifier

hostname           hostname

The above command will create a file called C0A80028 (IP address in HEX) located in /tftp/linux-install/pxelinux.cfg, which is the specific boot configuration file for that


default RHEL5

label RHEL5

kernel RHEL5/vmlinuz

append initrd=RHEL5/initrd.img  ramdisk_size=5939 ks=nfs:

After the client has obtained it’s IP address via DHCP it looks for the following configuration files, as you can see the C0A80028 file is called which if you remember was

created above.

Kickstart Configuration file

There are many options to a kickstart configuration file, i have supplied a basic one, adapt to your own tastes.

Alternatively you can use Kickstart configuration wizard to create KS.CFG File

install         # rather than upgrade

nfs –server= –dir=/export/kickstart  # Location of the install media, http, nfs etc

lang en_US.UTF-8

langsupport –default en_US.UTF-8

keyboard uk

mouse generic3usb –device input/mice

network –device=eth0 –bootproto=static –ip= –netmask= –gateway=???.???.???.??? –nameserver=???.???.???.??? -

-hostname Linuxks # we could specify static IP info too instead

rootpw password    # noencrypted password

firewall –disabled

selinux –disabled

authconfig –enableshadow –enablemd5

timezone Europe/London

bootloader –location=mbr –append=”noexec=off hda=noide”

# Any boot time options you wan to add

# I specified noide here as I was booting

# from SAN in this case.


# do not configure X Windows

zerombr yes

#Clear the Master Boot Record

clearpart –all –initlabel

#Partition clearing information

part /boot –fstype ext3 –size=150 –ondisk=hda

part pv.01 –size=1 –grow –ondisk=hda

part pv.02 –size=1 –grow –ondisk=hda

volgroup rootvg pv.01

volgroup satvg pv.02

logvol /    –vgname=rootvg –size=6000 –name=rootvol

logvol swap –vgname=rootvg –size=2000 –name=swapvol

# In the above partition layout (with LVM) I have

# used two disks, sda and sdb for different volumes.

# You don’t need to use LVM etc. HDA for IDE etc.

auth  –useshadow  –enablemd5

#System authorization information

%packages –resolvedeps

# This is the actual package install section. The

# resolvedeps option allows you to make mistakes and

# have anaconda sort it out for you, i.e. resolving

# package dependencies.

@ Base

@ Development Tools

@ Legacy Software Development

# base channels






# individual packages to add




# individual packages to add


# And so begins the post-install section.

# this is currently in a chroot to / on the

# new file system.

# Various variables I like to set first to use later


# I run everything in this, so I can log it

/bin/echo “Welcome to $HOSTNAME Server ” > /etc/motd

/bin/echo “Built from kickstart version $VER ” >> /etc/motd

/bin/echo ” ” >> /etc/motd

# One way of adding to files

cat >> /etc/sysctl.conf << EOF

fs.aio-max-size = 1048576

fs.file-max = 327680

net.core.rmem_max = 262144

net.core.wmem_max = 262144

net.core.rmem_default = 262144

net.core.wmem_default = 262144

net.ipv4.ip_local_port_range = 1024 65000

net.ipv4.ip_forward = 0

kernel.shmmax = 2147483648

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128


# Another way of inputing to files

# Here doing some system settings

useradd -c “Some lone user” -d /home/luser luser

echo luserpass | passwd –stdin luser

# Add a user if you like

# Setup hosts file

cat > /etc/hosts << EOF       localhost.localdomain           localhost     install-server.some.domain      install-server     another.machine.some.domain     another


# Edit the hosts file if you like

wget $SERVER/iptables.$lab -O /etc/sysconfig/iptables

# Here using the server variable we set at the

# top of the post-install section to pull some

# custom files we stored, in this case a firewall.

# In this case using a variable which could have been

# pulled from /proc/cmdline to get a specific one for

# each lab.

/sbin/chkconfig ip6tables off

/sbin/chkconfig isdn off

/sbin/chkconfig sendmail off

/sbin/chkconfig ntpd on

# Turn some services on and off

) > /tmp/kickstart-install.log 2>&1

# The aforementioned log.

Boot and Start the Installation

Just boot the server via the network (normally option F12) and if all goes well your client should install from the kickstart server

Post By Dinesh (18 Posts)