Monthly Archives: November 2011

Steps to configure the jconsole

jconsole, a very popularly used JMX-compliant monitoring tool, provides information on performance and resource consumption of applications running on the Java platform.
This can be used to monitor both local applications (those running on the same system as jconsole) and remote applications (those running on other systems).
Local monitoring with jconsole is useful for development and prototyping. Using jconsole locally is not recommended for production environments, because jconsole itself consumes significant system resources. Rather, use jconsole on a remote system to isolate it from the platform being monitored.

There may be lots of document found after googling, but I’ve tried to make this a compact one helpful for users.
There are two ways to configure the jconsole:
1) Configure using the command line properties
2) Using the jmxserverapp.war

1) Configure using the command line properties

In this approach, set the following system properties when you start the Java virtual machine (JVM).

This usually be set in the run.conf located in JBOSS_HOME/bin

JAVA_OPTS=”$JAVA_OPTS -Dcom.sun.management.jmxremote.port=19001 -Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false”

JMX URL: service:jmx:rmi:///jndi/rmi://:/jmxrmi

e.g.: service:jmx:rmi:///jndi/rmi://14.23.24.10:19001/jmxrmi

2) Using the jmxserverapp.war file

• Copy the war file located at the above location into the deploy folder of the JBoss instance
e.g.: /opt/jboss/jboss420/jboss-as/server/hjs-rtb1-merch-sprint.com/deploy

• Open the web.xml present in this application (e.g.:/opt/jboss/jboss420/jboss-as/server/hjs-rtb1-merch-sprint.com/deploy/jmxserverapp.war/WEB-INF/web.xml) and edit the values in bold below.

<?xml version=”1.0″ encoding=”UTF-8″?>

<web-app xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xmlns=”http://java.sun.com/xml/ns/javaee&#8221; xmlns:web=”http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&#8221; xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&#8221; id=”WebApp_ID” version=”2.5″>

<display-name>JMXPortServer</display-name>

 

<context-param>

<param-name>registryport</param-name>

<param-value>19012</param-value>

</context-param>

<context-param>

<param-name>server</param-name>

<param-value>14.23.24.10</param-value>

</context-param>

<context-param>

<param-name>rmiserverport</param-name>

<param-value>19013</param-value>

</context-param>

<servlet>

<servlet-name>JMXPortServer</servlet-name>

<servlet-class>com.sprint.server.JMXPortServer</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>JMXPortServer</servlet-name>

<url-pattern>/JMXPortServer</url-pattern>

</servlet-mapping>

 

<welcome-file-list>

<welcome-file>index.html</welcome-file>

<welcome-file>index.htm</welcome-file>

<welcome-file>index.jsp</welcome-file>

<welcome-file>default.html</welcome-file>

<welcome-file>default.htm</welcome-file>

<welcome-file>default.jsp</welcome-file>

</welcome-file-list>

</web-app>

• Open the run.conf and add the below system properties

JAVA_OPTS=”$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false”

• Restart the server instance using the startup scripts

JMX URL: service:jmx:rmi://:/jndi/rmi://:< registryport>/server

e.g.: service:jmx:rmi://14.23.24.10:19013/jndi/rmi://14.23.24.10:19012/server
Run jconsole:
Start jconsole by typing jconsole in a command shell. (This will be located in JAVA_HOME/bin) When you start jconsole without any arguments, it will automatically detect all local Java applications, and display a dialog box that enables you to select the application you want to monitor. Both jconsole and the application must by executed by the same user name, since the monitoring and monitoring system uses the operating system’s file permissions.
For remote Java applications, run the jconsole in a command shell and provide the JMX URL to connect.

Select the Remote Process and provide the JMX URL, which can be constructed as described above and click connect

 

Creating Virtual machine OVF file to deploy in any hypervisor that supports OVF.

What is OVF

As per vmware , OVF (Open Virtualization Format), new Virtualization standard which promise to deliver cross-platform vendor independent distribution framework.

In addition, the OVF is a standards-based, portable format that allows the user to deploy this virtual machine in any hypervisor that supports OVF.

VMDK v/s OVF

VMDK is a file format that only encodes a single virtual disk from a virtual machine. A VMDK does not contain information about the virtual hardware of a machine, such as the CPU, memory, disk, and network information. A virtual machine may include multiple virtual disks or VMDKs. An administrator who wishes to deploy a virtual disk must then configure all of this information, often manually, using incomplete documentation.

The OVF format, on the other hand, provides a complete specification of the virtual machine. This includes the full list of required virtual disks plus the required virtual hardware configuration, including CPU, memory, networking, and storage.

Scenario –

I am planning to create a web server with minimum requirement like RAM-256, single processor and small disk size which can hold the system configuration file along with HTTP package.

What happened when I need to add disk, I can add disk at run time and increase RAM and change the processor accordingly after importing the web server OVF on VMware environment.

The following change are required in order to work with HTTPD.

Add nic on OVF web server, configure IP and change the same IP setting on httpd.conf LISTEN parameter

like Listen x.x.x.x:80

Steps for OVF installation and configuration –

1 – Installation –

Download – VMware-ovftool-1.0.0-166674-win.i386 from Vmware.com website , installed it on windows system. I have installed it on windows 2008 DC.

Configure VMware ovftool installation path on exported PATH environmental variable so that it can be available throughout the system

like

Right Click on my computer - Properties  Advance system settings  Environmental Variables
System variables - select path - click on Edit button

Add the following on
C:Program Files (x86)VMwareVMware OVF Tool

Variables value.

Note – OVFTool installation path may be different so choose accordingly.

2 – Configuration –

1 – Configure a folder where newly created ovf files can reside.

in my example here is the path –

e:openfilerovf

2 – login on CMD and run the following command

C:Program Files (x86)VMwareVMware OVF Tool>ovftool.exe d:vmmachinesopenfilerOpenFiler.vmx e:openfilerovfopenfiler.ovf
Opening VMX source: d:vmmachinesopenfilerOpenFiler.vmx
Opening OVF target: e:openfilerovfopenfiler.ovf
Target: e:openfilerovfopenfiler.ovf
Disk Transfer Completed
Completed successfully

C:Program Files (x86)VMwareVMware OVF Tool>

3- Check if OVF file is successfully created or not –

E:>cd openfilerovf

E:openfilerovf>dir
Volume in drive E is Satya
Volume Serial Number is 0CC5-C258

Directory of E:openfilerovf

11/26/2011 03:03 PM .
11/26/2011 03:03 PM ..
11/26/2011 03:03 PM 384,115,200 openfiler-disk1.vmdk
11/26/2011 03:03 PM 131 openfiler.mf
11/26/2011 03:03 PM 3,864 openfiler.ovf
3 File(s) 384,119,195 bytes
2 Dir(s) 32,896,319,488 bytes free

E:openfilerovf>

NoteI have taken openfiler virtual machine for creating OVF format machine which can be deploy in any hypervisor that supports OVF.

VMware – Virtual Machines MAC address range assigned to VMware from IEEE..

IEEE has assigned specific range to VMWare for assigning MAC address to their virtual machines.

The vNIC MAC addresses include the OUI ( Organization Unique Identifiers) assigned by IEEE to Vmware.

The range may be use my VMware are –

1-     00-56-50-xx-xx-xx
2-     00-0c-29-xx-xx-xx

Note – Click on VM running on ESX/ESXi and check their MAC address. mostly it should be 00-56-50-xx-xx-xx

 

Compilation of busybox-1.18.3 in order to support additional POSIX command to Vsphere5

 Note –  This is unsupported features of VMware – Please use at own risks.
VMware is currently using BusyBox v1.9.1-VMware-visor-6030 on Vsphere5

Steps for compilation of busybox

Note– I am using CentOS 5.x for compiling BusyBox.

1 –  Download busybox on /usr/src/redhat/BUILD

[root@linux10 ~]# wget http://busybox.net/downloads/busybox-1.18.3.tar.bz2
–23:15:09–  http://busybox.net/downloads/busybox-1.18.3.tar.bz2
Resolving busybox.net… 140.211.167.224
Connecting to busybox.net|140.211.167.224|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 2119251 (2.0M) [application/x-bzip2]
Saving to: `busybox-1.18.3.tar.bz2′

100%[=====================================================================>] 2,119,251   35.4K/s   in 82s

23:16:32 (25.4 KB/s) – `busybox-1.18.3.tar.bz2′ saved [2119251/2119251]

You have new mail in /var/spool/mail/root
[root@linux10 ~]#

========================================================================

2 – Checking/Extracting the busybox

[root@linux10 BUILD]# ls -tlr
total 2076
-rw-r–r– 1 root root 2119251 Feb  9  2011 busybox-1.18.3.tar.bz2
[root@linux10 BUILD]# tar -xf busybox-1.18.3.tar.bz2
[root@linux10 BUILD]# cd busybox-1.18.3
[root@linux10 busybox-1.18.3]# ls
applets    console-tools  editors    INSTALL     mailutils        miscutils   README   sysklogd              TODO
arch       coreutils      examples   libbb       Makefile         modutils    runit    TEST_config_nommu     TODO_unicode
archival   debianutils    findutils  libpwdgrp   Makefile.custom  networking  scripts  TEST_config_noprintf  util-linux
AUTHORS    docs           include    LICENSE     Makefile.flags   printutils  selinux  TEST_config_rh9
Config.in  e2fsprogs      init       loginutils  Makefile.help    procps      shell    testsuite
[root@linux10 busybox-1.18.3]#

======================================================================================
3 – compiling busybox to largest generic configuration with defconfig

[root@linux10 busybox-1.18.3]# make defconfig
[root@linux10 busybox-1.18.3]# make

Last fews lines –

CC      util-linux/volume_id/volume_id.o
CC      util-linux/volume_id/xfs.o
AR      util-linux/volume_id/lib.a
LINK    busybox_unstripped
Trying libraries: crypt m
Library crypt is not needed, excluding it
Library m is needed, can’t exclude it (yet)
Final link with: m
DOC     busybox.pod
DOC     BusyBox.txt
DOC     busybox.1
DOC     BusyBox.html
[root@linux10 busybox-1.18.3]#

=====================================================================

4 –  If compilation went well it will create  “busybox” binary file inside the current directory

[root@linux10 busybox-1.18.3]# ls -trl busybox
-rwxr-xr-x 1 root root 744680 Nov  5 23:20 busybox

[root@linux10 busybox-1.18.3]# file busybox
busybox: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped

[root@linux10 busybox-1.18.3]# ./busybox
BusyBox v1.18.3 (2011-11-05 23:18:53 IST) multi-call binary.
Copyright (C) 1998-2009 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.

Usage: busybox [function] [arguments]…
or: busybox –list[-full]
or: function [arguments]…

BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable.  Most people will create a
link to busybox for each function they wish to use and BusyBox
will act like whatever it was invoked as.

Currently defined functions:
[, [[, acpid, add-shell, addgroup, adduser, adjtimex, arp, arping, ash, awk, base64, basename, beep, blkid, blockdev, bootchartd,
brctl, bunzip2, bzcat, bzip2, cal, cat, catv, chat, chattr, chgrp, chmod, chown, chpasswd, chpst, chroot, chrt, chvt, cksum, clear,
cmp, comm, cp, cpio, crond, crontab, cryptpw, cttyhack, cut, date, dc, dd, deallocvt, delgroup, deluser, depmod, devmem, df,
dhcprelay, diff, dirname, dmesg, dnsd, dnsdomainname, dos2unix, du, dumpkmap, dumpleases, echo, ed, egrep, eject, env, envdir,
envuidgid, ether-wake, expand, expr, fakeidentd, false, fbset, fbsplash, fdflush, fdformat, fdisk, fgconsole, fgrep, find, findfs,
flock, fold, free, freeramdisk, fsck, fsck.minix, fsync, ftpd, ftpget, ftpput, fuser, getopt, getty, grep, gunzip, gzip, halt, hd,
hdparm, head, hexdump, hostid, hostname, httpd, hush, hwclock, id, ifconfig, ifdown, ifenslave, ifplugd, ifup, inetd, init, insmod,
install, ionice, iostat, ip, ipaddr, ipcalc, ipcrm, ipcs, iplink, iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5,
klogd, last, length, less, linux32, linux64, linuxrc, ln, loadfont, loadkmap, logger, login, logname, logread, losetup, lpd, lpq,
lpr, ls, lsattr, lsmod, lspci, lsusb, lzcat, lzma, lzop, lzopcat, makedevs, makemime, man, md5sum, mdev, mesg, microcom, mkdir,
mkdosfs, mke2fs, mkfifo, mkfs.ext2, mkfs.minix, mkfs.vfat, mknod, mkpasswd, mkswap, mktemp, modinfo, modprobe, more, mount,
mountpoint, mpstat, mt, mv, nameif, nbd-client, nc, netstat, nice, nmeter, nohup, nslookup, ntpd, od, openvt, passwd, patch, pgrep,
pidof, ping, ping6, pipe_progress, pivot_root, pkill, pmap, popmaildir, poweroff, powertop, printenv, printf, ps, pscan, pwd,
raidautorun, rdate, rdev, readahead, readlink, readprofile, realpath, reboot, reformime, remove-shell, renice, reset, resize, rev,
rm, rmdir, rmmod, route, rpm, rpm2cpio, rtcwake, run-parts, runlevel, runsv, runsvdir, rx, script, scriptreplay, sed, sendmail, seq,
setarch, setconsole, setfont, setkeycodes, setlogcons, setsid, setuidgid, sh, sha1sum, sha256sum, sha512sum, showkey, slattach,
sleep, smemcap, softlimit, sort, split, start-stop-daemon, stat, strings, stty, su, sulogin, sum, sv, svlogd, swapoff, swapon,
switch_root, sync, sysctl, syslogd, tac, tail, tar, tcpsvd, tee, telnet, telnetd, test, tftp, tftpd, time, timeout, top, touch, tr,
traceroute, traceroute6, true, tty, ttysize, tunctl, udhcpc, udhcpd, udpsvd, umount, uname, unexpand, uniq, unix2dos, unlzma, unlzop,
unxz, unzip, uptime, usleep, uudecode, uuencode, vconfig, vi, vlock, volname, wall, watch, watchdog, wc, wget, which, who, whoami,
xargs, xz, xzcat, yes, zcat, zcip

[root@linux10 busybox-1.18.3]#

=============================================================================
5 – Edit the “Makefile” to modified the EXTRAVERSION like this
EXTRAVERSION = “-SatyendraSingh”

Note– You can use any meaningful name whatever you like

==========================================================================
6 – Now need to re run “make” command to write the modified EXTRAVERSION information on “busybox” binary

[root@linux10 busybox-1.18.3]# make

Few lines

LINK    busybox_unstripped
Trying libraries: crypt m
Library crypt is not needed, excluding it
Library m is needed, can’t exclude it (yet)
Final link with: m
You have new mail in /var/spool/mail/root
[root@linux10 busybox-1.18.3]#

=====================================================================

7 – Run the “busybox” on current directory to check what changes you made on “EXTRAVERSION”
[root@linux10 busybox-1.18.3]# ./busybox
BusyBox v1.18.3-SatyendraSingh (2011-11-05 23:18:53 IST) multi-call binary.
Copyright (C) 1998-2009 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.

Usage: busybox [function] [arguments]…
or: busybox –list[-full]
or: function [arguments]…

BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable.  Most people will create a
link to busybox for each function they wish to use and BusyBox
will act like whatever it was invoked as.

Currently defined functions:
[, [[, acpid, add-shell, addgroup, adduser, adjtimex, arp, arping, ash, awk, base64, basename, beep, blkid, blockdev, bootchartd,
brctl, bunzip2, bzcat, bzip2, cal, cat, catv, chat, chattr, chgrp, chmod, chown, chpasswd, chpst, chroot, chrt, chvt, cksum, clear,
cmp, comm, cp, cpio, crond, crontab, cryptpw, cttyhack, cut, date, dc, dd, deallocvt, delgroup, deluser, depmod, devmem, df,
dhcprelay, diff, dirname, dmesg, dnsd, dnsdomainname, dos2unix, du, dumpkmap, dumpleases, echo, ed, egrep, eject, env, envdir,
envuidgid, ether-wake, expand, expr, fakeidentd, false, fbset, fbsplash, fdflush, fdformat, fdisk, fgconsole, fgrep, find, findfs,
flock, fold, free, freeramdisk, fsck, fsck.minix, fsync, ftpd, ftpget, ftpput, fuser, getopt, getty, grep, gunzip, gzip, halt, hd,
hdparm, head, hexdump, hostid, hostname, httpd, hush, hwclock, id, ifconfig, ifdown, ifenslave, ifplugd, ifup, inetd, init, insmod,
install, ionice, iostat, ip, ipaddr, ipcalc, ipcrm, ipcs, iplink, iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5,
klogd, last, length, less, linux32, linux64, linuxrc, ln, loadfont, loadkmap, logger, login, logname, logread, losetup, lpd, lpq,
lpr, ls, lsattr, lsmod, lspci, lsusb, lzcat, lzma, lzop, lzopcat, makedevs, makemime, man, md5sum, mdev, mesg, microcom, mkdir,
mkdosfs, mke2fs, mkfifo, mkfs.ext2, mkfs.minix, mkfs.vfat, mknod, mkpasswd, mkswap, mktemp, modinfo, modprobe, more, mount,
mountpoint, mpstat, mt, mv, nameif, nbd-client, nc, netstat, nice, nmeter, nohup, nslookup, ntpd, od, openvt, passwd, patch, pgrep,
pidof, ping, ping6, pipe_progress, pivot_root, pkill, pmap, popmaildir, poweroff, powertop, printenv, printf, ps, pscan, pwd,
raidautorun, rdate, rdev, readahead, readlink, readprofile, realpath, reboot, reformime, remove-shell, renice, reset, resize, rev,
rm, rmdir, rmmod, route, rpm, rpm2cpio, rtcwake, run-parts, runlevel, runsv, runsvdir, rx, script, scriptreplay, sed, sendmail, seq,
setarch, setconsole, setfont, setkeycodes, setlogcons, setsid, setuidgid, sh, sha1sum, sha256sum, sha512sum, showkey, slattach,
sleep, smemcap, softlimit, sort, split, start-stop-daemon, stat, strings, stty, su, sulogin, sum, sv, svlogd, swapoff, swapon,
switch_root, sync, sysctl, syslogd, tac, tail, tar, tcpsvd, tee, telnet, telnetd, test, tftp, tftpd, time, timeout, top, touch, tr,
traceroute, traceroute6, true, tty, ttysize, tunctl, udhcpc, udhcpd, udpsvd, umount, uname, unexpand, uniq, unix2dos, unlzma, unlzop,
unxz, unzip, uptime, usleep, uudecode, uuencode, vconfig, vi, vlock, volname, wall, watch, watchdog, wc, wget, which, who, whoami,
xargs, xz, xzcat, yes, zcat, zcip

[root@linux10 busybox-1.18.3]#

Note- Check the following line under IInd line of point “5” for EXTRAVERSION changes you made.

BusyBox v1.18.3-SatyendraSingh (2011-11-05 23:18:53 IST) multi-call binary.
=========================================================================

8 – Renaming the “buxybox” binary to meaningful name in order to avoid any conflict with “busybox” binary if exist.

[root@linux10 busybox-1.18.3]# cp busybox busybox-satya
cp: overwrite `busybox-satya’? y

[root@linux10 busybox-1.18.3]# ./busybox-satya

BusyBox v1.18.3-SatyendraSingh (2011-11-05 23:18:53 IST) multi-call binary.
Copyright (C) 1998-2009 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.

==========================================================================

9 – copy the “busybox-satya” to vsphere5 and use as per the requirement but make sure some of the applet of busy box may/may not work

Let’s take an example

1 – If I want to see what is ifconfig output on vsphere5, I am not able to find it from command prompt

~ # ifconfig
-sh: ifconfig: not found
~ # busybox ifconfig
ifconfig: applet not found

But if I run with my own compiled busybox-satya, it gives me the same output as Unix does.

~ # /tmp/busybox-satya ifconfig
ifconfig: /proc/net/dev: No such file or directory
lo0       Link encap:Ethernet  HWaddr 00:00:08:00:10:08
inet addr:127.0.0.1  Mask:255.0.0.0
UP LOOPBACK RUNNING MULTICAST  MTU:16384  Metric:1

vmk0      Link encap:Ethernet  HWaddr 00:0C:29:E3:38:76
inet addr:192.168.1.9  Bcast:192.168.1.255  Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

2 – If I want to see what is crontab setting. I need to check the following way around –
~ # cat /var/spool/cron/crontabs/root
#min hour day mon dow command
1    1    *   *   *   /sbin/tmpwatch.py
1    *    *   *   *   /sbin/auto-backup.sh
0    *    *   *   *   /usr/lib/vmware/vmksummary/log-heartbeat.py

I tried to run the following commands as well but did not get the output

~ # busybox crontab -l
crontab: applet not found
~ #

But If I run with own compiled busybox-satya, It gives me the same output as Unix does. even I am able to edit/list the cron
~ # /tmp/busybox-satya crontab -l
#min hour day mon dow command
1    1    *   *   *   /sbin/tmpwatch.py
1    *    *   *   *   /sbin/auto-backup.sh
0    *    *   *   *   /usr/lib/vmware/vmksummary/log-heartbeat.py
~ # /tmp/busybox-satya crontab -e

~ # /tmp/busybox-satya crontab -l
#min hour day mon dow command
1    1    *   *   *   /sbin/tmpwatch.py
1    *    *   *   *   /sbin/auto-backup.sh
0    *    *   *   *   /usr/lib/vmware/vmksummary/log-heartbeat.py
#Satya here -5th Nov 2011

Note – I have added “#Satya here -5th Nov 2011” for example Purpose.
==============================================================================

How to compare processes/threads on system with sar ‘plist-sz’ output from apache prospective

Here are the steps of step to identified and compare/check  processes/threads on system with sar ‘plist.sz’ details and ps -eLf

1-         sar output –
uspvldmzlx25:~# sar -q | tail -30
07:20:02 AM         6       309      0.61      0.91      0.95
07:22:01 AM         0       292      0.82      0.99      0.98
07:24:01 AM         0       288      0.86      1.01      0.99
07:26:01 AM         0       285      1.24      1.15      1.04
07:28:01 AM         0       284      0.86      1.07      1.02
07:30:02 AM         5       293      0.64      0.95      0.98
07:32:01 AM         0       288      0.86      1.03      1.01
07:34:01 AM         1       290      1.01      1.00      1.00
07:36:01 AM         1       286      1.39      1.15      1.05
07:38:01 AM         0       289      1.24      1.19      1.07
07:40:01 AM         5       294      2.09      1.59      1.23
07:42:01 AM         0       285      1.49      1.68      1.32
07:44:01 AM         0       289      0.94      1.39      1.25
07:46:01 AM         0       295      2.08      1.69      1.37
2 –   Processes/Threads
test5:~# ps -eLf | wc -l
311
test5:~#
Note – If you compare the IInd column ( plist-sz)  of sar –q command it will show the same or near by value of ‘ps –eLf’
So its clear now that sar –q shown the process/thread , it will help us to analyze apache server max client issue if occurs any point of time.

VMware – Vsphere5 unattended installation step by step with PXE boot

>


Let me brief about the PXE environment I have setup on my home lab. I have installed CentOS 5.x and configuring TFTP, DHCP, APACHE for step by step vsphere5 unattended installation with PXE boot.
1 –  tftp-server installation/configuration  step by step if not already installed.
[root@linux10 xinetd.d]# yum install tftp-server
localrepo                 100% |=========================|  951 B    00:00    
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package tftp-server.i386 0:0.42-3.1.el5.centos set to be updated
–> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 tftp-server             i386       0.42-3.1.el5.centos  localrepo          27 k
Transaction Summary
=====================================================Install      1 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        
Total download size: 27 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: tftp-server                  ######################### [1/1]
Installed: tftp-server.i386 0:0.42-3.1.el5.centos
Complete!
[root@linux10 xinetd.d]# vi /etc/xinetd.d/tftp
Note – make disable = no inside the tftp file
[root@linux10 xinetd.d]# /etc/init.d/xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]
2- dhcp installation/configuration step by step if not installed already.
[root@linux10 tftpboot]# yum install dhcp
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package dhcp.i386 12:3.0.5-13.el5 set to be updated
–> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 dhcp                    i386       12:3.0.5-13.el5  localrepo         874 k
Transaction Summary
=============================================================================
Install      1 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        
Total download size: 874 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: dhcp                         ######################### [1/1]
Installed: dhcp.i386 12:3.0.5-13.el5
Complete!
 [root@linux10 tftpboot]# vi /etc/dhcpd.conf
[root@linux10 tftpboot]#
[root@linux10 tmp]# cat /etc/dhcpd.conf
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample 
###############################################################
# Note – This block is specifix to single host installation with match hardware address -00-0C-29-8D-FD-A0
    ddns-update-style ad-hoc;
    allow booting;
    allow bootp;
    #gPXE options
    option space gpxe;
    option gpxe-encap-opts code 175 = encapsulate gpxe;
    option gpxe.bus-id code 177 = string;
subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.200 192.168.1.254;
        default-lease-time 3600;
        max-lease-time 4800;
        option routers 192.168.1.1;
        option domain-name-servers 192.168.1.1;
        option subnet-mask 255.255.255.0;
        option ntp-servers 192.168.1.1;
}
#and the host block.
host esxi5first {
        hardware ethernet 00:0C:29:8D:FD:A0;
        fixed-address 192.168.1.210;
        option host-name “esxifirst”;
        filename “pxelinux.0”;
        next-server 192.168.1.101;
}
########################################################################
#Note – you want to deploy this over an entire subnet, it’d be a tedious task to create host blocks for every computer. Likewise, the following is perfectly valid. 
#######################################################################
 #   ddns-update-style ad-hoc;
 #   allow booting;
#    allow bootp;
###    #gPXE options
  #  option space gpxe;
 #   option gpxe-encap-opts code 175 = encapsulate gpxe;
 #   option gpxe.bus-id code 177 = string;
#subnet 192.168.1.0 netmask 255.255.255.0 {
 #       range 192.168.1.200 192.168.1.254;
 #       default-lease-time 3600;
 #       max-lease-time 4800;
 #       option routers 192.168.1.1;
 #       option domain-name-servers 192.168.1.1;
 #       option subnet-mask 255.255.255.0;
 #       option time-offset -7;
 #       option ntp-servers 192.168.1.1;
 #       option netbios-name-servers 192.168.1.1;
  #      filename “pxelinux.0”;
#        next-server 192.168.1.101;
#}
########################################################################
[root@linux10 ~]# /
Note
1 –  In /etc/dhcpd.conf file , please specify correct subnet/netmask/range/next-server IP etc.
2 – next-server IP is the DHCPD IP address where TFTPD is running for pxelinux.o client.
3 – This installation is based on  one box installation that is the reason I have mapped client machine hardware address inside /etc/dhcpd.conf file and specify the client  machine hostname as esxifirst.
However this gives you the opportunity to install whole subnet installation by uncomment the following from /etc/dhcpd.conf
#subnet 192.168.1.0 netmask 255.255.255.0 {
 #       range 192.168.1.200 192.168.1.254;
 #       default-lease-time 3600;
 #       max-lease-time 4800;
 #       option routers 192.168.1.1;
 #       option domain-name-servers 192.168.1.1;
 #       option subnet-mask 255.255.255.0;
 #       option time-offset -7;
 #       option ntp-servers 192.168.1.1;
 #       option netbios-name-servers 192.168.1.1;
  #      filename “pxelinux.0”;
#        next-server 192.168.1.101;
#}
And commenting
subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.200 192.168.1.254;
        default-lease-time 3600;
        max-lease-time 4800;
        option routers 192.168.1.1;
        option domain-name-servers 192.168.1.1;
        option subnet-mask 255.255.255.0;
        option ntp-servers 192.168.1.1;
}
#and the host block.
host esxi5first {
        hardware ethernet 00:0C:29:8D:FD:A0;
        fixed-address 192.168.1.210;
        option host-name “esxifirst”;
        filename “pxelinux.0”;
        next-server 192.168.1.101;
}
3 – Mounting the VMware-ESXi ISO image on Linux system in order to copy the entire files/folder on local system.
[root@linux10 ~]# mount -t iso9660 -o loop VMware-VMvisor-Installer-5.0.0-469512.x86_64.iso /mnt/
[root@linux10 ~]# cd /mnt/
4 – Create a folder named esxi5 inside /tftpboot directory and copy the ESXi5 content from /mnt to /tftpboot/esxi5/
[root@linux10 mnt]# mkdir –p  /tftpboot/esxi5/
[root@linux10 mnt]# cp -r * /tftpboot/esxi5/
[root@linux10 mnt]#
5 – Configuring and Copying PXELINUX.O file in order to get PXE boot.
Note – Please make sure syslinux version should be or greater than 3.86.x .
You can download it from here –
[root@linux10 xinetd.d]#cd /tmp
[root@linux10 xinetd.d]# gunzip syslinux-3.86.tar.gz
[root@linux10 xinetd.d]#tar xvf syslinux-3.86.tar
[root@linux10 xinetd.d]#cp /tmp/syslinux-3.86/core/pxelinux.0 /tftpboot/
[root@linux10 xinetd.d]# cd /tftpboot/
Note – Create pxelinux.cfg directory inside to /tftpboot to hold a boot file for vsphere5 installation along with kickstart location.
[root@linux10 tftpboot]# mkdir pxelinux.cfg
 [root@linux10 tftpboot]# ls
esxi5  pxelinux.0  pxelinux.cfg
[root@linux10 tftpboot]#
pxelinux is the utility that enables the PXE functionality. As mentioned before, pxelinux.0 is an executable that the server downloads. The executable provides functionality to parse a menu system, load kernels, options, customizations, modules, etc, and boot the server. Since PXE can be used by multiple physical servers for multiple images, we need to configure pxelinux for this specific image.
pxelinux.0 looks for configuration files in the TFTP:/pxelinux.cfg directory.
pxelinux looks for a large number of configuration files… specific to a default/generic value. This allows server administrators to define a file based on a complete MAC address, partial MAC address, or none at all to determine which image to boot from.
The installation media contains a file called isolinux.cfg. We can use this as the basis for our file called ‘default. Copy it from the installation media and start customizations:
[root@linux10 tftpboot]# cd pxelinux.cfg/
[root@linux10 pxelinux.cfg]# cp /tftpboot/esxi5/isolinux.cfg default
Notedefault is just a name .
Note – Edit the contents of default file as per requirement
[root@linux10 pxelinux.cfg]# cat default
prompt 1
timeout 10
label ESXi 5 install scripted
default /esxi5/menu.c32
menu label ^ESXi5-01 Scripted install
kernel /esxi5/mboot.c32
append -c /esxi5/boot.cfg ks=http://192.168.1.101/ks/esxi5.txt
[root@linux10 pxelinux.cfg]#
6 – Preparing Kickstart file –
Kick start address –   http://192.168.1.101/ks/esxi5.cfg
# Accept the VMware End User License Agreement
vmaccepteula
# Set the root password for the DCUI and Tech Support Mode
rootpw password
# Install on the first local disk available on machine
install –firstdisk –overwritevmfs
# Set the network to DHCP on the first network adapater, use the specified hostname and donot create a portgroup for the VMs
network –bootproto=dhcp –device=vmnic0
Note – You can prepare as per your standard.
7 – Configure the installation files
The CD/ISO installation media for ESXi 5.0 assumes a single installation point. Thus, all the files are placed at the root of the image. However, since we want to actually organize our installation root, we added the ‘/tftpboot/esxi5/ ‘ directory and copied the files into it. We need to adjust the installation files in /tftpboot/esxi5/ to reflect the change.
   [root@linux10 esxi5]#  cd /tftpboot/esxi5
   [root@linux10 esxi5]#  cp  boot.cfg boot.cfg.orig
  [root@linux10 esxi5]#  vi boot.cfg
Note – Add the prefix=/esxi5/ inside boot.cfg file  and remove all of the slashes (/) from the boot.cfg file so relative paths can be use
For example – it should be like useropts.gz not /useropts.gz ( by default this takes path as a /useropts.gz)
[root@linux10 esxi5]# cat boot.cfg
bootstate=0
title=Loading ESXi installer
prefix=/esxi5/
kernel=tboot.b00
#kernelopt=runweasel
modules=b.b00 — useropts.gz — k.b00 — a.b00 — ata-pata.v00 — ata-pata.v01 — ata-pata.v02 — ata-pata.v03 — ata-pata.v04 — ata-pata.v05 — ata-pata.v06 — ata-pata.v07 — block-cc.v00 — ehci-ehc.v00 — s.v00 — weaselin.i00 — ima-qla4.v00 — ipmi-ipm.v00 — ipmi-ipm.v01 — ipmi-ipm.v02 — misc-cni.v00 — misc-dri.v00 — net-be2n.v00 — net-bnx2.v00 — net-bnx2.v01 — net-cnic.v00 — net-e100.v00 — net-e100.v01 — net-enic.v00 — net-forc.v00 — net-igb.v00 — net-ixgb.v00 — net-nx-n.v00 — net-r816.v00 — net-r816.v01 — net-s2io.v00 — net-sky2.v00 — net-tg3.v00 — ohci-usb.v00 — sata-ahc.v00 — sata-ata.v00 — sata-sat.v00 — sata-sat.v01 — sata-sat.v02 — sata-sat.v03 — scsi-aac.v00 — scsi-adp.v00 — scsi-aic.v00 — scsi-bnx.v00 — scsi-fni.v00 — scsi-hps.v00 — scsi-ips.v00 — scsi-lpf.v00 — scsi-meg.v00 — scsi-meg.v01 — scsi-meg.v02 — scsi-mpt.v00 — scsi-mpt.v01 — scsi-mpt.v02 — scsi-qla.v00 — scsi-qla.v01 — uhci-usb.v00 — tools.t00 — imgdb.tgz — imgpayld.tgz
build=
updated=0
[root@linux10 esxi5]#
NoteI have commented kernelopts in boot.cfg
Note
 Boot the client machine, have a cup of coffee, installation will take place automatically.