Sunday 27 November 2011

PXE for windows install mounted drive

net use z: \\192.168.8.121\vista /u:192.168.8.121\administrator "apibkk"
net use z: \\192.168.8.121\vista64 /u:192.168.8.121\administrator "apibkk"
net use z: \\192.168.8.121\2008 /u:192.168.8.121\administrator "apibkk"
net use z: \\192.168.8.121\200864 /u:192.168.8.121\administrator "apibkk"
net use z: \\192.168.8.121\seven /u:192.168.8.121\administrator "apibkk"
net use z: \\192.168.8.121\seven64 /u:192.168.8.121\administrator "apibkk"

Sunday 2 October 2011

Startup PXE

1. Run C:\PXE\binl\binlsrv.exe
2. Run C:\PXE\tftpd32\tftpd32.exe
3. Start dhcpd service : service dhcpd restart
4. Start up share server

Monitor : tail -f /var/log/messages
leases file : /var/lib/dhcpd/dhcpd.leases

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

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.

Friday 11 March 2011

How to setup PXE boot server on Windows XP Part II

Ok After you got PXE boot server,The remaining steps are adding OS image for installation.Below steps are only for windows vista/2008/7 both 32 and 64 bit edition.

1. Install WinPE3.0 -> WAIK (Note: you need to install .NET Framework 2.0 and MSXML 6 SP1 as well)
2. Run [4a_WinPE.cmd] and [4b_WinPE.cmd] so easy.
3. Configure file
C:\PXE\tftpboot\pxelinux.cfg\default by adding below entry

LABEL winpe
MENU LABEL WinPE 3.0
KERNEL /boot/pxeboot.0

4.
Add option for OS installation
  • If adding Windows Vista, copy all files and folder from Windows Vista source to C:\PXE\tftpboot\vista\ - share C:\PXE\tftpboot\vista\ as vista
  • If adding Windows 2008, copy all files and folder from Windows 2008 source to C:\PXE\tftpboot\2008\ - share C:\PXE\tftpboot\2008\ as 2008
  • If adding Windows 7, copy all files and folder from Windows 7 source to C:\PXE\tftpboot\seven\ - share C:\PXE\tftpboot\seven\ as seven
5. Start C:\PXE\tftpd32\tftpd32.exe
6.
Start C:\PXE\binl\binlsrv.exe
7.
Boot the client PC using PXE boot option
8. Select an option from the menu
9. Select the first Ramdisk options entry if your source files are 32-bit or Select the second Ramdisk options entry if your source files are 64-bit
10. Once WinPE has booted enter command.Select one below:
Vista : net use z: \\[your server's ip]\vista /u:[your server's ip]\[your server's user] "[your user's password]"
2008 : net use z: \\[your server's ip]\2008 /u:[your server's ip]\[your server's user] "[your user's password]"
7 : net use z: \\[your server's ip]\7 /u:[your server's ip]\[your server's user] "[your user's password]"
10. Enter drive Z:
11. run setup.exe then enjoy!!!

Thursday 10 March 2011

How to setup PXE boot server on Windows XP

Credit by : http://diddy.boot-land.net/pxe/files/walkthrough.htm
Thank you so much
Link for script and a cool guide -> http://diddy.boot-land.net/ccount12/click.php?id=3

[My steps are quite for a dummy user,don't need to know anything about the theories;If you would like to understand about PXE,read the cool guide above.]

System Requirement:
1. PXE boot server : Windows XP sp3 32bit
2. PXE client : Support PXE boot sequence.
3. Network setup in the same lan.

Preparation phase on PXE boot server:
1. Create mandatory directory c:\PXE Recommand use creating script [1_create_folders.cmd]
2. Share C:\PXE\tftpboot\ as tftpboot - simple file sharing must be used for the share [Just click Right and share it]
3. Add registry patch and reboot PC - open notepad,copy and paste code below

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters]
"NullSessionPipes"=hex(7):43,00,4f,00,4d,00,4e,00,41,00,50,00,00,00,43,00,4f,00,4d,00,4e,00,4f,00,44,00,45,00,00,00,53,00,51,00,4c,00,5c,00,51,00,55,00,45,00,52,00,59,00,00,00,53,00,50,00,4f,00,4f,00,4c,00,53,00,53,00,00,00,4c,00,4c,00,53,00,52,00,50,00,43,00,00,00,62,00,72,00,6f,00,77,00,73,00,65,00,72,00,00,00,73,00,72,00,76,00,73,00,76,00,63,00,00,00,00,00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
"RestrictAnonymous"=dword:00000000

save as PXEboot.reg and exit,then double click the file.Don't forget reboot your server.
4. Install helpful tools
4.1 7-zip Windows 32 command line version -> http://www.7-zip.org/ download and install it after that copy file C:\Program Files\7-Zip\7z.exe to C:\PXE\tools.Change the exe file name from 7z to 7za because our script uses this format!!
4.2 Download gsar -> http://gnuwin32.sourceforge.net/packages/gsar.htm download and install it that copy file C:\Program Files\GnuWin32\bin\gsar.exe to C:\PXE\tools.
4.3 Download syslinux version x.xx -> http://www.kernel.org/pub/linux/utils/boot/syslinux/ download and save it in C:\PXE\tools
4.4 Download tftpd32 -> http://tftpd32.jounin.net/tftpd32_download.html download and save it in C:\PXE\tftpd32\
4.5 Download binl.zip -> http://diddy.boot-land.net/ccount12/click.php?id=5 and extract the contents to C:\PXE\binl\
5. Modified script [_parameters.cmd]

set SERVER_IP=[your server's ip]

The default is 192.168.2.2.Change it!!!

set syslinux=[your syslinux zip file name]

The default is syslinux-3.80.zip.Change it!!!
6. Run [2a_syslinux.cmd]
7. Configure C:\PXE\tftpd32\tftpd32.exe.Read carefully
7.1 Click Settings button
7.2 On the Global tab -> select only TFTP server and DHCP server
7.3 On TFTP tab -> set Base Directory as C:\PXE\tftpboot , TFTP security as Read only ,Advanced TFTP options select only Option negotiation.
7.4 On DHCP tab -> set DHCP Pool definition depends on your requirement.Boot file needs to be pxelinux.0

OK..Now we got the PXE boot server,Let's try by starting your client and booting it with PXE.
Boot menu will appear but no selectable OS..absolutely continue in part II.