Module – 23 Linux PXE boot (kickstart)

About PXE Booting and Kickstart Technology

One of the key requirements of provisioning is the hardware server’s ability to boot over the network instead of a diskette or CD-ROM.

There are several ways computers can boot over a network, and Preboot Execution Environment (PXE) is one of them.

PXE is an open industry standard supported by a number of hardware and software vendors. PXE is part of the “Wired for Management” (WfM) specification, which is part of a bigger PC98 specification defined by Intel and Microsoft in 1998.

PXE works with Network Interface Card (NIC) of the system by making it function like a boot device.

The PXE-enabled NIC of the client sends out a broadcast request to DHCP server, which returns with the IP address of the client along with the address of the TFTP server, and the location of boot files on the TFTP server.

The following steps describe how it works:

  1. Target Machine (either bare metal or with boot sector removed) is booted.
  2. The Network Interface Card (NIC) of the machine triggers a DHCP request.
  3. DHCP server intercepts the request and responds with standard information (IP, subnet mask, gateway, DNS etc.). In addition, it provides information about the location of a TFTP server and boot image (pxelinux.0).
  4. When the client receives this information, it contacts the TFTP server for obtaining the boot image.
  5. TFTP server sends the boot image (pxelinux.0), and the client executes it.
  6. By default, the boot image searches the pxelinux.cfg directory on TFTP server for boot configuration files on the TFTP server.
  7. Thee client downloads all the files it needs (kernel and root file system), and then loads them.
  8. Target Machine reboots.

The Provisioning application uses Redhat’s Kickstart method to automate the installation of Redhat Linux on target machines.

Using kickstart, the system administrator can create a single file containing answers to all the questions that will usually be asked during a typical Red Hat Linux installation.

The host specific boot configuration file contains the location of the kickstart file.

This kickstart file would have been created earlier by the stage directive of the OS image based on the input from user.

Follow the below video “Configure PXE kickstart in 5 minutes”

 

Note:

For both Kickstart server & client;  change the VM’s network adapter setting to “Bridged Adapter” & “Allow All”

 

 1. Install Packages:

# yum install dhcp tftp-server nfs-utils syslinux vsftpd

2. Install & configure DHCP

cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#   see ‘man 5 dhcpd.conf’
#
default-lease-time 600;
max-lease-time 7200;
allow booting;
allow bootp;
authoritative;
subnet 10.0.1.0 netmask 255.255.255.0 {
 range 10.0.1.199 10.0.1.205;
 next-server 10.0.1.199;
 filename “pxelinux.0″;
}

Step:3 Start the DHCP service

# service dhcpd start

Step:4 Update tftp & restart the service

 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
{
socket_type        = dgram
protocol        = udp
wait            = yes
user            = root
server            = /usr/sbin/in.tftpd
server_args        = -s /var/lib/tftpboot
disable            = no
per_source        = 11
cps            = 100 2
flags            = IPv4
}

# service xinetd restart

Step:5

cd /var/lib/tftpboot

mkdir -p /var/ftp/pub/rhel6/

mount /dev/cdrom /var/ftp/pub/rhel6/

cp -a /var/ftp/pub/rhel6/isolinux/* .

mkdir pxelinux.cfg

cp isolinux.cfg pxelinux.cfg/default

Step:6

vi  /var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32
#prompt 1
timeout 30
display boot.msg
menu background splash.jpg
menu title Welcome to Red Hat Enterprise Linux 6.4!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000

label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
  append initrd=initrd.img linux ks=ftp://10.0.1.199/pub/ks.cfg
label vesa
menu label Install system with ^basic video driver
kernel vmlinuz
append initrd=initrd.img xdriver=vesa nomodeset
label rescue
menu label ^Rescue installed system
kernel vmlinuz
append initrd=initrd.img rescue
label local
menu label Boot from ^local drive
localboot 0xffff
label memtest86
menu label ^Memory test
kernel memtest
append –

cp /root/anaconda-ks.cfg /var/ftp/pub/ks.cfg

vi /var/ftp/pub/ks.cfg
# Kickstart file automatically generated by anaconda.

#version=DEVEL
install
#cdrom
url –url=”ftp://10.0.1.199/pub/rhel6″
lang en_US.UTF-8
keyboard us
network –onboot no –device eth0 –bootproto dhcp –noipv6
rootpw  –iscrypted $6$BFmnePV3cvHqM4T0$IX33ukqBJdZZYIcolKvGlkrLjnT.bnwt1XJx3jk9CkY7oYwRBAsa4J0qDzsFJUQMkVMMO7NnhVkg2rrTtVS58.
firewall –service=ssh
authconfig –enableshadow –passalgo=sha512
selinux –enforcing
timezone –utc America/New_York
bootloader –location=mbr –driveorder=sda –append=”crashkernel=auto 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 –linux –drives=sda
clearpart –all –initlabel –drives=sda
part /boot –fstype=ext4 –size=500
part pv.008002 –grow –size=1
volgroup VolGroup –pesize=4096 pv.008002
logvol / –fstype=ext4 –name=lv_root –vgname=VolGroup –grow –size=1024 –maxsize=51200
logvol swap –name=lv_swap –vgname=VolGroup –grow –size=2944 –maxsize=2944

#part /boot –fstype=ext4 –size=500
#part pv.008002 –grow –size=1
%packages
@base
@client-mgmt-tools
@console-internet
@core
@debugging
@directory-client
@hardware-monitoring
@java-platform
@large-systems
@network-file-system-client
@performance
@perl-runtime
@server-platform
@server-policy
pax
python-dmidecode
oddjob
sgpio
device-mapper-persistent-data
samba-winbind
certmonger
pam_krb5
krb5-workstation
perl-DBD-SQLite
%end

 

Step:7

service vsftpd restart

service dhcpd restart

service xinetd restart

Step:7

cp /usr/share/syslinux/pxelinux.0 .

 

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>