Earlier we have covered how to setup PXE server on CentOS. This post will guide you how to setup PXE server on Ubuntu,

Required Packages
DHCP Server
TFTP Server

Installing required packages

apt-get -y install tftpd-hpa syslinux

Configuring TFTP Server

/etc/init.d/openbsd-inetd stop
update-rc.d -f openbsd-inetd remove
sed -i s/no/yes/ /etc/default/tftpd-hpa
/etc/init.d/tftpd-hpa start

Configuring DHCP Server
Add this to you existing or new /etc/dhcp3/dhcpd.conf
Note: xxx.xxx.xxx.xxx is the IP address of your PXE server
For installing dhcp server on ubuntu you can check my previous post

allow booting;
allow bootp;
next-server xxx.xxx.xxx.xxx;
filename "/pxelinux.0";
/etc/init.d/dhcp3-server restart

Copy needed files from syslinux to the tftpboot directory

cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot
cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot
cp /usr/lib/syslinux/menu.c32 /var/lib/tftpboot
cp /usr/lib/syslinux/memdisk /var/lib/tftpboot
cp /usr/lib/syslinux/mboot.c32 /var/lib/tftpboot
cp /usr/lib/syslinux/chain.c32 /var/lib/tftpboot

Now we are using our PXE server to install CentOS 5.4 on client machine. So create a base directory for images and insert CentOS 5.4 dvd.

mkdir -p /var/lib/tftpboot/images/centos/i386/5.4
cp /tmp/dvd-centos-54/images/pxeboot/vmlinuz /var/lib/tftpboot/images/centos/i386/5.4/
cp /tmp/dvd-centos-54/images/pxeboot/initrd.img /var/lib/tftpboot/images/centos/i386/5.4/

Create the directory for your PXE menus

mkdir /var/lib/tftpboot/pxelinux.cfg

My sample config file

vi /var/lib/tftpboot/pxelinux.cfg/default
default menu.c32
prompt 0
timeout 50
ONTIMEOUT localboot
LABEL localboot
MENU LABEL Boot From Hard Disk
LABEL CentoS 5.4 i386 Installer
MENU LABEL CentOS 5.4 i386 Installer
KERNEL images/centos/i386/5.4/vmlinuz
append vga=normal initrd=images/centos/i386/5.4/initrd.img ramdisk_size=32768
PXE Boot Server on Ubuntu

Leave a Reply

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