PXE booting Lucid Lynx Ubuntu -10.04

Earlier we have covered how to setup pxe server. Now we will see how to run ubuntu live cd from 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
cd /mnt/iso/
cp -av * /nfs-share/ubuntu/

Entries in nfs share export file

cat /etc/exports
/nfs-share/ubuntu/    *(no_root_squash,rw,async)

Refresh nfs entries

exportfs -rv

Entries in pxelinux.cfg/default my root directory of tftpboot is /tftpboot

LABEL Ubuntu
kernel /tftpboot/images/ubuntu/vmlinuz
append boot=casper netboot=nfs nfsroot=192.168.3.20:/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/

Thats it. Run your pxe client and choose ubuntu.

UPDATE
After installing Ubuntu if your network is not working then you need to modify interface settings in /etc/network/interfaces. Change it to

auto eth0
iface eth0 inet dhcp

#DHCP if you are taking ip from DHCP server else mention it as static and provide ip address.

PXE Boot server on CentOS

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

vi /etc/xinetd.d/tftp
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";
service dhcpd restart

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

Page 2 of 2«12
rss twitter facbook

Categories

Archives