Pxeboot CentOS Environment

While re-purposing a few old Google Search Appliances I set up a Network Boot Enviornment as follows:

Organised Chaos

Install Dependencies

yum install tftp-server tftp syslinux httpd dhcp

Configure tftp

mkdir /tftpboot

vi /etc/xinetd.d/tftp

service tftp
socket_type             = dgram
protocol                = udp
wait                    = yes
user                    = root
server                  = /usr/sbin/in.tftpd
server_args             = -s -v /tftpboot
disable                 = no
per_source              = 11
cps                     = 100 2
flags                   = IPv4


service xinetd restart

Change tftp Permissions

chown -R nobody /tftpboot

Copy the Boot Files and DVD Files

cp /usr/share/syslinux/{pxelinux.0,menu.c32,memdisk,mboot.c32,chain.c32} /tftpboot

Next I copied ISO files for CentOS distributions to the machine and mounted them loopback to retrieve files from them – copying the files necessary for booting under the tftpboot directory and also copying the DVD contents to the web root so later the installer can access the installation media:

mkdir -p /var/www/html/images/centos/{i386,x86_64}/6.4/


mount -o loop ./CentOS-6.4-i386-bin-DVD1.iso /mnt
cp /mnt/images/pxeboot/{vmlinuz,initrd.img} /tftpboot/images/centos/i386/6.4/
cp -R /mnt/* /var/www/html/images/centos/i386/6.4/
umount /mnt
mount -o loop ./CentOS-6.4-x86_64-bin-DVD1.iso /mnt
cp /mnt/images/pxeboot/{vmlinuz,initrd.img} /tftpboot/images/centos/x86_64/6.4/
cp -R /mnt/* /var/www/html/images/centos/x86_64/6.4/

Test tftp is working

cd /tmp


get pxelinux.0

Configure DHCP

vi /etc/dhcp/dhcpd.conf

I used the basic configuration below:

allow booting;
allow bootp;

option domain-name "qub.ac.uk";
option subnet-mask;
option domain-name-servers,;

default-lease-time 600;
max-lease-time 7200;

log-facility local7;

subnet netmask  {
filename "pxelinux.0";
option subnet-mask;
option broadcast-address;
option routers;
host mynewmachine {
hardware ethernet       00:15:17:79:B9:78;
fixed-address ;



Add CentOS to the Menu

vi /tftpboot/pxelinux.cfg/default

DISPLAY boot.txt

DEFAULT centos6

LABEL centos6_64
kernel images/centos/x86_64/6.4/vmlinuz
append ks vga=normal initrd=images/centos/x86_64/6.4/initrd.img ramdisk_size=100000 ip=dhcp url --url

LABEL centos6_32
kernel images/centos/i386/6.4/vmlinuz
append ks vga=normal initrd=images/centos/i386/6.4/initrd.img ramdisk_size=100000 ip=dhcp url --url



vi /tftpboot/boot.txt

- Boot Menu -

Boot the Target Computer

When booting the target computer you can watch the progress on the server with:

tail -f /var/log/messages

The target computer should display the contents of the boot.txt file with a boot: prompt. At the prompt type “centos6_64” and press enter. The CentOS installation should then proceed.

If there are any problems check:

  • The permissions of the /tftpboot directory and files
  • The /var/log/messages contents
  • Consider switching off iptables and SElinux

Leave a Reply

  • (will not be published)

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