This post will be helpful for linux admins who frequently installs diff linux os. PXE boot is one of the best option to start linux installation & for rescue of the other failed systems. we are using CentOS as pxe boot server.
Install tftp-server
yum install -y tftp-server
Enable tftp server
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s -vv /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
Start tftp server and mark it for system startup
service xinetd restart
chkconfig --level 35 xinetd on
We have to download the latest version of syslinux and build the rpm cause there are some bugs in the existing version that ships with centos.
cd /root
wget http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.86.tar.gz
tar -zxvf syslinux-3.86.tar.gz
cp syslinux-3.86/syslinux.spec /usr/src/redhat/SPECS/
cp syslinux-3.86.tar.gz /usr/src/redhat/SOURCES
Now building the rpm
cd /usr/src/redhat/SPECS
sed -i 's/BuildPrereq: nasm >= 2.03, perl/BuildPrereq: perl/g' /usr/src/redhat/SPECS/syslinux.spec
rpmbuild -ba syslinux.spec
Installing rpm
cd /usr/src/redhat/RPMS/i386
rpm -Uvh syslinux-3.86-1.i386.rpm
Copy needed files from syslinux to the tftpboot directory
cp /usr/share/syslinux/pxelinux.0 /tftpboot
cp /usr/share/syslinux/menu.c32 /tftpboot
cp /usr/share/syslinux/memdisk /tftpboot
cp /usr/share/syslinux/mboot.c32 /tftpboot
cp /usr/share/syslinux/chain.c32 /tftpboot
Create a base directory for images. Create directories for each CentOS release you are supporting.
mkdir -p /tftpboot/images/centos/i386/5.4
cp /tmp/dvd-centos-54/images/pxeboot/vmlinuz /tftpboot/images/centos/i386/5.4/
cp /tmp/dvd-centos-54/images/pxeboot/initrd.img /tftpboot/images/centos/i386/5.4/
Configure dhcp-server.
Add this to your existing or new /etc/dhcpd.conf.
Note: xxx.xxx.xxx.xxx is the IP address of your PXE server
For configuring dhcp server you can check my previous post
allow booting;
allow bootp;
next-server xxx.xxx.xxx.xxx; # IP of my PXE server
filename "/pxelinux.0";
Create the directory for your PXE menus
mkdir /tftpboot/pxelinux.cfg
My sample config file
vi /tftpboot/pxelinux.cfg/default
default menu.c32
prompt 0
timeout 50
ONTIMEOUT localboot
MENU TITLE PXE Menu
LABEL localboot
MENU LABEL Boot From Hard Disk
LOCALBOOT 0
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
Now start the client machine, boot it from lan, it should get a DHCP lease, and start booting successfully from the network
For troubleshooting check /var/log/messages
Credits