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

Thursday 19 May 2011

How to setup PXE boot server on Windows XP Part III

I got a new requirement from my team to add RHEL and SUSE into the existing PXE boot server,OK that would be easier than Windows.

Tested OS:
RHEL AS4U8/5U6/6
SUSE 10sp3/11sp1

My PXE boot is just a normal windows xp machine with 20 GB harddisk that is insufficient for keeping all os images so I decided to setup NFS in different machine.Fortunately there is unused SUN server in my farm so I will setup it as my NFS server to keep images file.

1. At your NFS server,mount the iso file:

[root@RFATEST184 /]# mount -F hsfs -o ro `lofiadm -a /temp/rhel-server-6.0-i386-dvd.iso` /mnt

2. Created and shared file in directory /share/pxe

[root@RFATEST184 pxe]# share
- /share/pxe ro ""

3. Copy all files in /mnt to /share/pxe/[OS image]

[root@RFATEST184 pxe]# cp -pr /mnt/* /share/pxe/32as6/

4. Check required file in your share directory

For RHEL
[root@RFATEST184 32as6]# pwd
/share/pxe/32as6
[root@RFATEST184 32as6]# ls -li images/pxeboot/
total 63074
275230 -r--r--r-- 1 root root 441 Sep 23 2010 TRANS.TBL
275231 -r--r--r-- 1 root root 28587578 Sep 23 2010 initrd.img
275232 -r-xr-xr-x 1 root root 3667328 Sep 23 2010 vmlinuz

For SUSE
[root@RFATEST184 loader]# pwd
/share/pxe/32suse10sp3/DVD1/boot/i386/loader
[root@RFATEST184 loader]# ls -li linux initrd
576202 -rw-r--r-- 1 root root 10726367 May 14 13:03 initrd
576210 -rw-r--r-- 1 root root 1305277 May 14 13:03 linux

5. Now open your windows xp PXE boot server then ftp to NFS and copy 'image' directory for RHEL or 'boot' directory for SUSE to tftpboot directory

C:\PXE\tftpboot>ls 32as6\images\pxeboot
TRANS.TBL initrd.img vmlinuz

C:\PXE\tftpboot>ls 32suse10sp3\boot\i386\loader\linux
32suse10sp3\boot\i386\loader\linux

C:\PXE\tftpboot>ls 32suse10sp3\boot\i386\loader\initrd
32suse10sp3\boot\i386\loader\initrd

6. Configure file C:\PXE\tftpboot\pxelinux.cfg\default by adding below entry and save it.

For RHEL
label 32AS6
menu label Install AS6 32bit
kernel /32as6/images/pxeboot/vmlinuz
append initrd=/32as6/images/pxeboot/initrd.img switches

For SUSE
label 32suse10
menu label Install Suse 10sp3 32bit
kernel /32suse10sp3/boot/i386/loader/linux
append initrd=/32suse10sp3/boot/i386/loader/initrd splash=silent showopts

7.
Boot the client PC using PXE boot option
8. Select an option from the menu
9. the ramdisk OS will be loaded.Don't forget to select Network/NFS source image for installation(Setup NFS's IP and shared directory)
10. enjoy setup.