Title: Implement a PXE Boot Menu
Course: CIS 208: Linux/UNIX III: Intermediate System Administration, Networking, and Security ~ For IGNITE Review > Section: Learning Modules

Implement a PXE Boot Menu

DHCP service

The first step is to configure a dhcp server.  Install the dhcp package and view the configuration and documentations files.

yum install dhcp
rpm -qc dhcp
rpm  -qd dhcp
cat /usr/share/doc/dhcp*/dhcpd.conf.sample > /etc/dhcp/dhcpd.conf

Notice that the dhcpd.conf file has 4 subnet definitions.  Comment out the first three, then edit the remaining one to match the local network.

For now we will turn off iptables and selinux, then start the dhcpd service.

service iptables stop
chkconfig iptables off
setenforce permissive
sed -i 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config
service dhcpd start
chkconfig dhcpd on

Using another computer on the local network, verify that it is able to give out an IP address, a gateway, one or more nameservers, and a search domain.

TFTP service

Install the Trivial File Transfer Protocol service, configure it to run at boot time and create a link for easy access to the boot files.

yum install tftp-server
service tftp start
chkconfig tftp on
ln -s /var/lib/tftpboot /tftpboot

DNS service

Verify that dns is working correctly for both forward and reverse lookups.  This will be needed to provide fully automated installations.  If needed, install bind and configure authoritative zones.  Ensure that the service functions and that it is set to run at boot time.

HTTP service

A webserver is useful for mirroring repositories and providing files during the PXE boot process.  If desired, set up virtual hosts and create dns entries for the virtual hosts.  The apache package is called httpd in Red Hat derivative distributions.

If local mirrors are desired, write a script to run rsync to pull down the files from each repository.  This script will need to be run from a cronjob regularly after the initial synchronization has completed.  Ensure that the same directory structure is maintained within the URL used to access each repo.  For example, since Centos uses http://mirror.centos.org/centos/ as the top level directory, the files would need to be synchronized to /var/www/html/centos.  The following command will sync the entire Centos repository.

rsync -aHv mirrors.kernel.org:centos /var/www/html

Various options can be included to the rsync command such as --delay-updates, --exclude and --delete-excluded.

PXE support files

A set of files are needed to provide a kernel with network boot support and a menu to PXE clients.  Install the syslinux package, then copy the files to the /tftpboot directory.

yum install syslinux
cp /usr/share/syslinux/pxelinux.0 /tftpboot
mkdir /tftpboot/pxelinux.cfg

cat > /tftpboot/pxelinux.cfg/default <<\EoT
default 1
timeout 100
prompt 1
display f1.msg
F1 f1.msg
label 1
localboot 0
EoT

cat > /tftpboot/f1.txt <<EoT
=== PXE Boot Menu ===
[f1] this menu
[1] boot normally
(if no key is pressed in 10 seconds, this system will boot normally)
EoT