Monday, October 5, 2009
Linux PXE boot Step by step guide
I wish I could post the screen shots of provisioning/cloning etc using RHN satellite server.
hmm everything is confidential (corporate companies). provisioning using RHN satellite server
is easy and more controllable.
1)Install dhcp and tftp-server
yum install dhcp tftp-server
2)Configure DHCP for PXE boot
Add following entries
#cat /etc/dhcpd.conf
ddns-update-style interim;
allow booting;
allow bootp;
# Standard configuration directives...
subnet 192.168.95.0 netmask 255.255.255.0 {
# option domain-name "nwd.ne.gov";
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.95.255;
option domain-name-servers 10.41.10.105;
# option routers default_router;
next-server 192.168.95.3;
}
# Group the PXE bootable hosts together
group {
# PXE-specific configuration directives...
#next-server 192.168.95.3;
filename "pxelinux.0";
# You need an entry like this for every host
# unless you're using dynamic addresses
host lrhdol1 {
hardware ethernet 00:0C:29:09:AA:E8;
fixed-address 192.168.95.5;
option host-name "lrhdol1";
}
}
3)copy pxelinux.cfg, menu.c32 on to tftpboot directory
#For pxelinux image
cp /usr/lib/syslinux/pxelinux.0 /tftpboot
#For menu (Blue screen with lables)
cp /usr/lib/syslinux/menu.c32 /tftpboot
if you want to use other /tftpboot dir, change in /etc/xinetd.d/tftp file
grep server /etc/xinetd.d/tftp
# description: The tftp server serves files using the trivial file transfer \
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
and
Edit the file /etc/xinetd.d/tftp and change the line that says “disable = yes” to “disable = no “.
3) create pxelinux.cfg directory for menu options
cd /tftpboot
mkdir pxelinux.cfg
touch 000C2909AAE8
touch C0A85F05
touch C0A85F0
touch C0A85F
....
..
touch C
touch default
4) create Menu file
This I have created for CENT OS and RHEL 5
#cat default
PROMPT 0
TIMEOUT 100
MENU TITLE PXE INSTALL press Esc for boot menu
F1 msgdir/boot.msg
F2 msgdir/options.msg
LABEL localdisk
localboot 1
LABEL RHEL5
kernel linux/RHEL5/vmlinuz
append initrd=linux/RHEL5/initrd.img netboot=nfs nfsroot=192.168.95.3:/media/RHEL5
LABEL CENTOS5
kernel linux/CENTOS5/vmlinuz
append initrd=linux/CENTOS5/initrd.img netboot=nfs nfsroot=192.168.95.3:/media/CENTOS5 ks=nfs:192.168.95.3:/nfsroot/CENTOS5.cfg
LABEL RESCUE
kernel linux/CENTOS5/vmlinuz
append rescue initrd=linux/CENTOS5/initrd.img netboot=nfs nfsroot=192.168.95.3:/media/CENTOS5 ks=nfs:192.168.95.3:/nfsroot/rescue.cfg
4a )
Add *.msg files are text,edit/create according to your needs
# pwd;ls -m
/tftpboot/msgdir
boot.msg, general.msg, options.msg, param.msg, rescue.msg
4b) CENTOS5.cfg,RHEL5.cfg created using system-config-kickstart utility.
cat rescue.cfg
# System keyboard
keyboard us
# System language
lang en_US
# Use NFS installation media
nfs --server=192.168.95.3 --dir=/media/CENTOS5
# Network information
network --bootproto=static --device=eth0 --gateway=192.168.95.2 --ip=192.168.95.5 --nameserver=10.41.10.105 --netmask=255.255.255.0 --onboot=on
6)Mount respective media and do NFS export.
EX:
mount -o loop /dev/cdrom /media/RHEL5/
cat /etc/exports
/media/RHEL5 *(insecure,rw,no_root_squash,async,no_subtree_check)
Run exportfs
7)start dhcpd,xinetd and tftp
service dhcpd start
service xinetd restart
/sbin/chkconfig tftp on
#/sbin/chkconfig --list tftp
tftp on
for DHCP,tftp errors check /var/log/messages file
8) PXE boot server and enjoy.
Directory listing of /tftpboot
#ls -R
.:
linux memdisk menu.c32 msgdir pxelinux.0 pxelinux.cfg
./linux:
CENTOS5 RHEL5
./linux/CENTOS5:
initrd.img README TRANS.TBL vmlinuz
./linux/RHEL5:
initrd.img README TRANS.TBL vmlinuz
./msgdir:
boot.msg general.msg options.msg param.msg rescue.msg
./pxelinux.cfg:
000C2909AAE8 C000025B default
Thursday, October 1, 2009
Subscribe to:
Posts (Atom)