Monday, July 18, 2011

PXE boot notes

pxe boot client
pxe boot server (centos version)


This works with latest version – ubuntu 10.10.
Once you are done setting-up PXE Server, you might need few OS booting from network / pxe for rescue purpose.
Ubuntu 10.04 can be configured to boot from network & can be used for system rescue.
Following is the procedure to boot Ubuntu 10.04 using PXE.
Mount ubuntu live iso on pxe server
mkdir /mnt/iso
mount ubuntu-10.04-desktop-i386.iso /mnt/iso

Create nfs share for ubuntu & copy all the content of live cd to it
mkdir /nfs-share/ubuntu -p
cp -rfva /mnt/iso/* /nfs-share/ubuntu/
cp -rfva /mnt/iso/.disk /nfs-share/ubuntu/

Enter following in /etc/exports
/nfs-share/ubuntu/ *(no_root_squash,rw,async)

Apply changes
exportfs -rv

Enter following in /tftpboot/pxelinux.cfg/default
LABEL Ubuntu-10.04
kernel /tftpboot/images/ubuntu/vmlinuz
append boot=casper netboot=nfs nfsroot=NFSSERVER:/nfs-share/ubuntu initrd=/tftpboot/images/ubuntu/initrd.lz
Copy initrd and vmlinuz from Ubuntu live cd to tftpboot
cd /nfs-share/ubuntu/casper
cp vmlinuz initrd.lz /tftpboot/images/ubuntu/

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 syslinux & tftp-server

yum install tftp-server syslinux -y
enable syslinux at boot time.
vi /etc/xinetd.d/tftp and change disable to ‘no’
disable = no
service xinetd restart
chkconfig xinetd on
Copy needed files from syslinux to the tftpboot directory
cp /usr/lib/syslinux/pxelinux.0 /tftpboot
cp /usr/lib/syslinux/menu.c32 /tftpboot
cp /usr/lib/syslinux/memdisk /tftpboot
cp /usr/lib/syslinux/mboot.c32 /tftpboot
cp /usr/lib/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: is the IP address of your PXE server

How to configure dhcp server on centos
allow booting;
allow bootp;
option option-128 code 128 = string;
option option-129 code 129 = text;
filename “/pxelinux.0″;
service dhcpd restart
Create the directory for your PXE menus
mkdir /tftpboot/pxelinux.cfg
Sample config file
vi /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
LABEL CentoS 5.5 i386 Installer
MENU LABEL CentOS 5.5 i386 Installer
KERNEL images/centos/i386/5.5/vmlinuz
append vga=normal initrd=images/centos/i386/5.5/initrd.img ramdisk_size=32768

No comments:

Post a Comment