Friday, 24 June 2011

Basic DHCP configuration for PXE

Setup DHCP for others network and let client boot the image from the PXE boot server.

# vi /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
authoritative;

subnet 192.168.8.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.8.254;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.8.255;
# --- NIS configuration
option nis-domain "RFAQANIS";
option nis-servers 192.168.8.150;
# --- Domain name configuration
option domain-name "RFAQANIS";
option domain-name-servers 10.42.33.25;
# --- Other configuration
option time-offset -18000; # Eastern Standard Time
# --- Dynamic ip provided only for diskless server
range dynamic-bootp 192.168.8.86 192.168.8.91;
default-lease-time 21600;
max-lease-time 43200;
}

allow booting;
allow bootp;

# PXE-spcecific configuration directories...
next-server [PXE-server-IP];
filename "pxelinux.0";

Tuesday, 31 May 2011

Kickstart Guide for RHEL

This post continued from PXE boot server setup but the propose of this is to create an automatic setup configure/script while install RHEL via PXE.
(refer to PXE boot server configure in previous post --> http://aflando.blogspot.com/2011/05/how-to-setup-pxe-boot-server-on-windows.html)

[Basic requirements]
1. Automatic install via NFS server(assume 192.168.8.184:/share/pxe already been shared)
2. Have a default value and let client click next to confirm or change it to own value.
3. Default value for keyboard, language and timezone.
4. Automatic add key(only AS5)
5. Start x windows on boot with GNOME
6. Interactive Network configuration
7. Firewall disabled (Not recommended)
8. Enable shadowed MD5 passwords
9. SELinux disabled (Not recommended)
10. Configure boot loader
11. Interactive disk layout
12. Automatic selecting package

[KickStart configuration]
/share/pxe/install/kickstart/ks.cnf file :

# RedHat Enterprise WS Kickstart configuration
## - - install type/source - - - - - - - - - - -
install
interactive
nfs --server=192.168.8.184 --dir=/share/pxe/32as4u8

## - - language and input support - - - - - - - -
lang en_US
keyboard us
timezone Asia/Bangkok

# enable X at boot time with GNOME as the default desktop
xconfig --startxonboot --defaultdesktop=GNOME

# for the install we get the IP address by DHCP
# AS4U8 network --device eth0 --bootproto dhcp
# AS5U6 network --bootproto=query
--noipv6
# AS6 xxxx
network --device eth0 --bootproto dhcp

firewall --disabled

# enable shadowed MD5 passwords
authconfig --enableshadow --enablemd5
selinux --disabled

## - - boot loader- - - - - - - - - -
bootloader --location=mbr

clearpart --all --initlabel

#For AS4U8 and AS5U6
%packages
@ X Window System
@ GNOME Desktop Environment
@ FTP Server
@ Legacy Network Server
@ Administration Tools
@ System Tools

#AS4U8 will not select telnet-server,Let post script do
#AS5U8 will auto-select

telnet-server

#Package section for AS6
#%packages
#@ X Window System
#@ Desktop
#@ FTP Server
#@ Networking Tools
#telnet
#telnet-server

# post-installation script starts
%post --interpreter /bin/sh

mkdir -p /mnt/tmp
mount 192.168.8.184:/share/pxe/32as4u8 -o ro /mnt/tmp
# run the top-level post-install script
# AS4U8 cd /mnt/tmp/RedHat/RPMS
# AS5U6 cd /mnt/tmp/Server
# AS6 cd /mnt/tmp/Server/Packages/
cd /mnt/tmp/RedHat/RPMS
rpm -ivf telnet-server*
cd /
# unmount the disk and delete the mount point
umount /mnt/tmp
rmdir /mnt/tmp

# enable telnet service
chkconfig telnet on
chkconfig vsftpd on
service xinetd restart
service vsftpd restart
mv /etc/securetty /etc/securetty.org
# post-installation script ends

[PXE boot server configuration]

Configure file C:\PXE\tftpboot\pxelinux.cfg\default
Example for AS4U8 :

label 32as4u8
menu label Install AS4U8 32bit
kernel /32as4u8/images/pxeboot/vmlinuz
append initrd=/32as4u8/images/pxeboot/initrd.img console=tty0 ks=nfs:192.168.8.184:/share/pxe/install/kickstart/32as4u8_ks.cfg ramdisk_size=268235456

Monday, 30 May 2011

How to setup PXE boot server on Windows XP Part IV

New requirement came again.Let's setup PXE for booting VMware ESXi and Solaris 10 (x86).

For VMware ESXi
1. Create directory C:\PXE\tftpboot\vmware\esxi that contain all files from ESXi iso.

2. Update content of C:\PXE\tftpboot\pxelinux.cfg\default

label ESXi
menu label Install VMware ESXi 4.0
kernel /vmware/esxi/mboot.c32
append /vmware/esxi/vmkboot.gz --- /vmware/esxi/vmkernel.gz --- /vmware/esxi/sys.vgz --- /vmware/esxi/cim.vgz --- /vmware/esxi/ienviron.tgz --- /vmware/esxi/image.tgz --- /vmware/esxi/install.tgz --- /vmware/esxi/cimstg.tgz
iappend 2

3. Done.So easy!!!

For Solatis 10 x86
Actually Solaris 10 x86 can be installed via jumpstart but I would like to mix them all together to only one mechanism that is PXEboot.
Solaris has a pxe file (pxegrub) for booting via pxe but it can not be loaded directly.
We need to configure pxelinux to load pxegrub and pxegrub will load menu.lst

At your NFS server
1. mount the iso file:
[root@RFATEST184 /]# mount -F hsfs -o ro `lofiadm -a /temp/sol-10-u9-ga-x86-dvd.iso` /mnt

note : if lofiadm is busy uses command below then mount mnt
[root@RFATEST184 /]# lofiadm
Block Device File
/dev/lofi/1 /temp/sol-10-u9-ga-x86-dvd.iso
[root@RFATEST184 /]# lofiadm -d /dev/lofi/1

2. Created and shared file in directory /pxeboot/solarisX86
[root@RFATEST184 /]# share
- /pxeboot ro ""

note : changed /etc/dfs/dfshare by adding line
share -F nfs -o ro /pxeboot
and save then use command shareall

3. Go to /mnt/Solaris_10/Tools that run setup_install_server and wait

[root@RFATEST184 /]# ./setup_install_server /pxeboot/solarisX86/

4. Check required file in your shared directory

[root@RFATEST184 boot]# ls -li multiboot x86.miniroot grub/pxegrub grub/menu.ls
t
474188 -r--r--r-- 1 root root 564 Aug 12 2010 grub/menu.lst
474191 -r--r--r-- 1 root root 139920 Aug 6 2010 grub/pxegrub
474202 -r-xr-xr-x 1 root root 136552 Aug 12 2010 multiboot
474209 -r--r--r-- 1 root root 87891019 Aug 12 2010 x86.miniroot

5. Now open your windows xp PXE boot server then ftp to NFS server and copy required file
****important****
change file pxegrub to pxegrub.0 (add .0)

Directory of C:\PXE\tftpboot\solarisX86\boot
08/12/2010 12:00 AM 136,552 multiboot

08/12/2010 12:00 AM 87,891,019 x86.miniroot


Directory of C:\PXE\tftpboot\Boot\grub

05/30/2011 05:03 PM 260 menu.lst

08/06/2010 12:00 AM 139,920 pxegrub.0


Note : menu.lst need to be in boot\grub dir because your pxegrub.0 will look into that dir by default
6. Configure file C:\PXE\tftpboot\pxelinux.cfg\default by adding below entry and save it.

label SolarisX86

menu label Install Solaris 10U9 X86

kernel /boot/grub/pxegrub.0

7.
Configure file C:\PXE\tftpboot\Boot\grub\menu.lst

timeout=15

title Solaris 10 Update 9 x86

kernel /solarisX86/boot/multiboot kernel/unix -v -m verbose install nfs://192.168.8.184/pxeboot/solarisX86/jumpstart/config.tar -B install_media=192.168.8.184:/pxeboot/solarisX86/

module /solarisX86/boot/x86.miniroot


8. Get back to NFS server,We still missed config.tar that contain 4 files in /pxeboot/solarisX86/jumpstart (create new dir)

8.1 rules file
[root@RFATEST184 jumpstart]# cat rules
any - - any_machine -

8.2 rules.ok file
[root@RFATEST184 jumpstart]# cat rules.ok

any - - any_machine -

# version=2 checksum=num

8.3 sysidcfg file
[root@RFATEST184 jumpstart]# cat sysidcfg

system_locale=en_US

install_locale=en_US

terminal=vt100

name_service=NONE

network_interface=PRIMARY {protocol_ipv6=no}

security_policy=NONE

timeserver=localhost

8.4 any_machine file
[root@RFATEST184 jumpstart]# cat any_machine

install_type initial_install

cluster SUNWCXall

package SUNWaccr add

fdisk all solaris all

partitioning explicit

filesys any free /

filesys any 4096 swap

system_type server

8.5 Then tar all file
[root@RFATEST184 jumpstart]# tar c rules rules.ok any_machine sysidcfg > /pxeboot/solarisX86/jumpstart/config.tar


9. Done