VMware Cloud Community
Effective
Enthusiast
Enthusiast
Jump to solution

manual installation of ESX with NFS as installation source.

Hi,

For education purposes I used to install ESX 3 using an NFS-share as a source.

So the servers PXE-boot and the ESX setup GUI is automatically loaded.

On my PXE-boot server I used to have a .cfg file with a label like this :

LABEL manual

kernel ./vmware/vmlinuz

append ip=dhcp initrd=./vmware/initrd.img method=nfs:192.168.1.12:/PXEInstallESX ksdevice=eth0 lang=en_US keymap=be-latin1

If I convert this for vSphere4, I tried something like this :

LABEL vSphere4

kernel ./vSphere4/vmlinuz

append initrd=./vSphere4/initrd.img mem=512 ip=dhcp method=nfs:192.168.1.12/PXEInstallVI4 ksdevice=vmnic0 quiet

But it doesn't work...

The server boots into vSphere Setup GUI but after a few screens it asks for the CD-rom.

Any help is greatly appreciated.

kind regards,

Koen

0 Kudos
1 Solution

Accepted Solutions
Smoggy
VMware Employee
VMware Employee
Jump to solution

do you have the beta install guide? PXE Boot section from beta doc was:

PXE Booting

You can use the files in isolinux/ on the ESX DVD image for PXE booting the ESX installer. Consider the following sample configuration file for tftp/pxelinux:

label VMware-Classic

menu label VMware-Classic

kernel VMware-Classic/vmlinuz

append initrd=VMware-Classic/initrd.img mem=512M quiet

ks=http://<path_to_ks_file>

The ks= option is required if you are doing a scripted installation with PXE boot.

Not sure if this helps. Don't have an environment setup for PXE at the moment to test on.

Best Regards,

Lee

View solution in original post

0 Kudos
19 Replies
Effective
Enthusiast
Enthusiast
Jump to solution

Meanwhile I also tried with a ks.cfg file and that doesn't work either.

Has anybody a working ks.cfg file available for vSphere4 ?

Kind regards,

K.

0 Kudos
Smoggy
VMware Employee
VMware Employee
Jump to solution

do you have the beta install guide? PXE Boot section from beta doc was:

PXE Booting

You can use the files in isolinux/ on the ESX DVD image for PXE booting the ESX installer. Consider the following sample configuration file for tftp/pxelinux:

label VMware-Classic

menu label VMware-Classic

kernel VMware-Classic/vmlinuz

append initrd=VMware-Classic/initrd.img mem=512M quiet

ks=http://<path_to_ks_file>

The ks= option is required if you are doing a scripted installation with PXE boot.

Not sure if this helps. Don't have an environment setup for PXE at the moment to test on.

Best Regards,

Lee

0 Kudos
Effective
Enthusiast
Enthusiast
Jump to solution

Jip, tried it before but this doesn't really work, ... any other ideas, not much info in the documentation about it ...

0 Kudos
Smoggy
VMware Employee
VMware Employee
Jump to solution

In the "almost ready" GA Install Guide for vSphere there is a LOT of detail on this. Far more than is in the beta guide(s) so hopefully you won't be disappointed. I cannot release the full document at the moment as we are still putting the finishing touches to it. I can cut n paste what I hope are some useful extracts that might point you in the right direction. One of the main changes is that we now use weasel and not anaconda.

If you are performing a scripted installation, you must point to the media depot in the script by including the install command with the nfs or url option.The following code snippet from an ESX installation script demonstrates how to format the pointer to the media depot if you are using NFS:

install nfs --server=example.com --dir=/nfs3/VMware/ESX/40

If you are performing an interactive installation instead of a scripted installation, include the askmedia boot option, which causes the installer to prompt you for the location of the media. You can type the askmedia option at the end of the boot options list. For example:

Boot Options initrd=initrd.img vmkopts=debugLogToSerial:1 mem=512M askmedia

The boot options list appears when you boot the installer and press F2.

ks=nfs://<server>/<path> Performs a scripted installation with the script located at <path> on a given NFS server.

Following is an example of a PXE configuration file that you might use with PXELINUX without gPXE. See also the /isolinux/isolinux.cfg file on the ESX installation DVD.

default menu.c32

menu title ESX Boot Menu

timeout 30

##PXE boot the installer and perform an interactive installation

##with local media (RPM files)

label local

menu label Interactive Local Installation

kernel http://<server>/vmlinuz

append initrd=http://<server>/initrd.img vmkopts=debugLogToSerial:1 mem=512M quiet

##PXE boot the installer and perform a scripted installation with

##local or remote media (RPM files), as specified in the installation script

label scripted

menu label Scripted Installation

kernel http://<server>/vmlinuz

append initrd=http://<server>/initrd.img vmkopts=debugLogToSerial:1 mem=512M ks=nfs://

10.20.118.55/ks.cfg

##PXE boot the installer and perform a scripted installation with

##local or remote media (RPM files), as specified in the installation script

label scripted

menu label Scripted Installation

kernel test/vmlinuz

append initrd=test/initrd.img vmkopts=debugLogToSerial:1 mem=512M ks=nfs://10.20.118.55/ks.cfg

Required Files

In the PXE configuration file, you must include paths to the following files:

vmlinuz is the boot loader kernel code.

initrd.img is the boot ramdisk.

The path test/ used in the example is relative to /tftpboot. The actual path is /tftpboot/test/ on the TFTP server.

Installation Mode

ks=nfs://10.20.118.55/ks.cfg is the path to the ESX installation script. In a scripted installation, your script includes all the necessary responses to fill in the blanks, including the location of the installation media.

IPAPPEND

For scripted installations, the IPAPPEND option specifies that the same network adapter the machine boots from is also used for connecting to the network. When you include the IPAPPEND option in the PXE configuration file, omit the --device option to the installation script network command. The IPAPPEND option as no impact on interactive installations. The following snippet shows how to include the IPAPPEND option in the PXE configuration file:

label Installer

menu default

kernel http://<server>/vmlinuz

append initrd=http://<server>/initrd.img mem=512M vmkopts=debugLogToSerial:1 ks=nfs://

10.20.118.55/ks.cfg

IPAPPEND

For the IPAPPEND flag_val, use IPAPPEND 2. IPAPPEND 1 is not required. If you omit the network --device option from the installation script, the IPAPPEND option from the PXE configuration file, and the netdevice bootstrap command, the installer uses the first plugged in network dapter.

Filename for the PXE Configuration File

For the filename of the PXE configuration file, choose one of the following:

01-<mac_address_of_target_ESX_host>. For example, 01-23-45-67-89-0a-bc

The target ESX host IP address in hexadecimal notation.

default

The initial boot file, pxelinux.0 tries to load a PXE configuration file. First it tries with the MAC address of the target ESX host, prefixed with its ARP type code (01 for Ethernet). If that fails, it tries with the hexadecimal notation of target ESX system IP address. Ultimately, it tries to load a file named default. or example, you might save the file on the TFTP server at /tftpboot/pxelinux.cfg/01-00-21-5a-ce-40-f6. The MAC address of the network adapter on the target ESX host is 00-21-5a-ce-40-f6.

File Location for the PXE Configuration File

Save the file in /tftpboot/pxelinux.cfg/ on the TFTP server.

Kernel Image and Ramdisk Directory

The kernel image and ramdisk directory contains files that that must be loaded across the network to enable PXE booting of the ESX installer. vmlinuz is a Linux kernel used for booting. The kernel is located in the initrd.img file.

The kernel image and ramdisk directory is located on a Web server (for gPXE) or on the TFTP server in the /ftpboot directory (for PXELINUX without gPXE. For example, the directory might be at /tftpboot/esx/ and contain the following files:

-rrr-- 1 root root 1922578 Nov 12 05:51 initrd.img

-rrr-- 1 root root 966633 Nov 12 05:51 vmlinuz

These files come from the ESX installation DVD, under the /isolinux directory. You reference the vmlinuz and initrd.img files from the PXE configuration file. The following code snippet shows how you reference vmlinuz and initrd.img in the PXE configuration script:

kernel esx/vmlinuz

append initrd=esx/initrd.img ...

...

Effective
Enthusiast
Enthusiast
Jump to solution

Hi,

The "askmedia" boot option works for me now ... thanks a lot !

At least now I can install servers without CD's Smiley Wink

Next step would be the ks-file, but I didn't have the time to look into this yet.

Thanks for the help,

Koen

0 Kudos
Smoggy
VMware Employee
VMware Employee
Jump to solution

glad to have helped. sorry I cannot upload the actual document you need yet but I am sure you appreciate my hands are tied where that stuff is concerned.

shouldn't be long now and the full vSphere documentation set will be there for all to see and download.

best regards,

Lee Dilworth

mikef123
Contributor
Contributor
Jump to solution

Smoggy, does the install nfs --server line go in the kickstart file or the cfg file under /tftpboot/pxelinux.cfg? I'm trying to PXE boot and it seems as if the nfs python scripts aren't even in the initrd.img file. I've been pxe booting about 50 3.5 esx servers for quite a while and the nfs doesn't seem to work. I haven't tried http yet but I like NFS better.

thanks

Mike

0 Kudos
Smoggy
VMware Employee
VMware Employee
Jump to solution

the PXE config file would usually contain something like this:

##PXE boot the installer and perform a scripted installation with

##local or remote media (RPM files), as specified in the installation script

label scripted

menu label Scripted Installation

kernel test/vmlinuz

append initrd=test/initrd.img vmkopts=debugLogToSerial:1 mem=512M ks=nfs://10.20.118.55/ks.cfg

In this example "ks=nfs://10.20.118.55/ks.cfg" is the path to the ESX installation script. In a scripted installation, your script includes all the necessary responses to fill in the blanks, including the location of the installation media. So the Install option goes into the ks.cfg file.

hope this helps,

Lee

0 Kudos
mikef123
Contributor
Contributor
Jump to solution

Thanks Lee for your response.

I'm wondering if the release of vSphere I have is too early to support PXE. I have the RC1 dvd. The install never NFS mounts /tftpboot. I have my PXE cfg file under /tftboot/pxelinux.cfg with a file named after the hex representation of the ip. Tailing the /var/log/messages file never shows the nfs mount request. It does get the initial dhcp ip from my dhcp server loads vmlinux and initrd.img, I get an error "kernel won't load out of memory". My server is a Dell 1950 with 16G of memory so I don't think i'm actuall out of memory. Do you know if there are later versions of vSphere that are out there?

Regards

Mike

0 Kudos
Smoggy
VMware Employee
VMware Employee
Jump to solution

could be.

I don't have that build handy anymore to check. If you believe the rumours then how far from GA code download can we be? Smiley Happy you might want to wait for that. I know thats not a massive comfort but might save you time trying to fix something that will not work in the build you have right now.

cheers

Lee

0 Kudos
rbeam
Contributor
Contributor
Jump to solution

Simple answer, the RC/Beta (140815) wasn't intended to be net installed. (at least from my 30s of dealing with it.) The anaconda 'method=nfs' is meaningless. My quick and dirty solution has been to change the cd mount script (/etc/vmware/init/init.d/11.85...) to a) return immediately if the media is already mounted, and b) load the nfs modules and mount the nfs volume otherwise. Since I'm just playing with ESX4 on a few machines, I've not bothered to dig any deeper or edit the initrd -- instead I just fix the script on every boot. If I were installing more than 2 machines, the initrd would be altered.

0 Kudos
allb18c
Enthusiast
Enthusiast
Jump to solution

How did you get the askmedia command to work? i tried it several times and it still looks like the installer is going through the virtual mount.

My command is:

Boot Options initrd=initrd.img vmkopts=debugLogToSerial:1 mem=512M Boot Options ks=nfs:/server/ks.cfg askmedia

What am I doing wrong? Thanks

0 Kudos
rbeam
Contributor
Contributor
Jump to solution

I looked into it deeper...

      1. vSphere (ESX 4.0 BETA)

label esx4

kernel vSphere/vmlinuz

append initrd=vSphere/initrd.img nofb vmkopts=debugLogToSerial:1 mem=512M text root=/dev/ram netdevice=vmnic0 url=nfs://server/exports/installer/esx-4.0.0-140815

label esx4-ks

kernel vSphere/vmlinuz

append initrd=vSphere/initrd.img nofb vmkopts=debugLogToSerial:1 mem=512M text root=/dev/ram netdevice=vmnic0 ks=nfs://server/ks-esx4.cfg

It still looks for a CD, but doesn't care that it's not there.

0 Kudos
admin
Immortal
Immortal
Jump to solution

Scripted installs and the "askmedia" option are mutually exclusive.

Do you want to do a scripted install, or an interactive install?

Also, there is a typo in your 'ks' option. it should be a URL like this ks=nfs://some.server.example.com/path/to/ks.cfg

0 Kudos
allb18c
Enthusiast
Enthusiast
Jump to solution

Hi there,

This is my scenario. We use HP hardware and we are using the virtual media option in ILO to mount the boot disk.

Once I get into the boot options, I'd like to tell the install to boot off of NFS instead of continuing on booting from virtual media, hence the "askmedia" option.

After that, I like to run my automated scipt using the ks=nfs://some.server.example.com/path/to/ks.cfg command. My script does contain the following:

install nfs --server=%server% --dir=/path/to/installation/media/

More often than I receive the "cannot find media" message when its trying to load ESX from virtual media. This is very annoying and when we perform our mass upgrade I'd like it to go as smooth as possible.

Is this even possible? Or will I need to go to a pixie boot method then run the automated script. Any insight we be great. Thanks.

0 Kudos
admin
Immortal
Immortal
Jump to solution

> This is my scenario. We use HP hardware and we are using the virtual media option in ILO to mount the boot disk.

> Once I get into the boot options, I'd like to tell the install to boot off of NFS instead of continuing on booting from virtual media, hence the "askmedia" option.

You should probably read through the Installation Guide carefully. Using a virtual media CD, the kernel and initrd will always come from the CD.

The "askmedia" option has a very specific meaning. It tells the Text or GUI installer to prompt the user for the location of the installation media (the RPM files).

If you want to boot (ie, get the kernel and initrd) from a network location, you'll need to use PXE.

> More often than I receive the "cannot find media" message when its trying to load ESX from virtual media.

> This is very annoying and when we perform our mass upgrade I'd like it to go as smooth as possible.

In my experience iLO virtual media is troublesome, especially on high load or high latency networks. There is a section in the Installation Guide about tested versions of iLO, but I would recommend a PXE + Scripted Install approach for a large deployment.

0 Kudos
mikef123
Contributor
Contributor
Jump to solution

has anybody got a %post script to work correctly. My post doesn't run on V4, it works perfectly on V3.5U4.

Anyone have any ideas?

accepteula

keyboard us

  1. Reboot after install ?

reboot

auth --enablemd5 --enableshadow

  1. Canonical drive names:

#clearpart --drives=mpx.vmhba0:C0:T0:L0 --overwritevmfs

  1. Uncomment to use first detected disk:

clearpart --firstdisk --overwritevmfs

  1. Uncomment the esxlocation line and comment out the clearpart

  2. and physical partitions to do a non-destructive reinstall.

#esxlocation --uuid=84c88269-07f6-44cb-9826-6720c4851a3f

install nfs --server=192.168.1.20 --dir=/vm41

rootpw --iscrypted $1$N.g0RraN$CSCWJiG6Mc.64ooX/ZJRP.

timezone --utc 'America/New_York'

network --addvmportgroup=true --device=vmnic0 --bootproto=static --ip=192.168.201.201 --netmask=255.255.255.0 --gateway=192.168.201.1 --nameserver=10.127.70.1 --hostname=VM41.corp.emc.com

part '/boot' --fstype=ext3 --size=1100 --ondisk=mpx.vmhba0:C0:T0:L0

  1. Uncomment to use first detected disk:

#part '/boot' --fstype=ext3 --size=1100 --onfirstdisk

part 'none' --fstype=vmkcore --size=110 --ondisk=mpx.vmhba0:C0:T0:L0

  1. Uncomment to use first detected disk:

#part 'none' --fstype=vmkcore --size=110 --onfirstdisk

part 'Storage1' --fstype=vmfs3 --size=8604 --grow --ondisk=mpx.vmhba0:C0:T0:L0

  1. Uncomment to use first detected disk:

#part 'Storage1' --fstype=vmfs3 --size=8604 --grow --onfirstdisk

virtualdisk 'esxconsole' --size=7604 --onvmfs='Storage1'

part 'swap' --fstype=swap --size=600 --onvirtualdisk='esxconsole'

part '/var/log' --fstype=ext3 --size=2000 --onvirtualdisk='esxconsole'

part '/' --fstype=ext3 --size=5000 --grow --onvirtualdisk='esxconsole'

%post

#--interpreter=bash

  1. ======================

  2. Add Groups and Users

  3. =====================

/usr/sbin/groupadd -g 1001 curly

/usr/sbin/useradd -u 1001 -g curly curly

  1. ======================

  2. Make Directory to Install

  3. ======================

/bin/mkdir -p /root/install

  1. ======================

  2. Perl script to download all necessary software and configuration files

  3. ======================

cat << \EOF > /root/install/download.pl

#!/usr/bin/perl -w

use LWP::Simple;

system("/usr/sbin/esxcfg-firewall --allowOutgoing 2&>/dev/null");

my $download_source = "http://192.168.201.248/software";

&download("$download_source/naviagentcli.noarch.rpm","/root/install/naviagentcli.noarch.rpm");

&download("$download_source/ESX_install.sh","/root/install/ESX_install.sh");

&download("$download_source/sshd_config","/etc/ssh/sshd_config");

&download("$download_source/root","/var/spool/cron/root");

system("/usr/sbin/esxcfg-firewall --blockOutgoing 2&>/dev/null");

sub download(){

my $file_source = shift;

my $file_target = shift;

print "Downloading $file_source to $file_target: ";

my $status = getstore($file_source,$file_target);

if ( $status eq '200' ){

print "ok\n";

}else{

print "failed \n";

}

}

EOF

  1. Call the script

chmod 777 /root/install/download.pl

/usr/bin/perl /root/install/download.pl

#echo "Software installation" > /dev/tty2

  1. =============================

  2. Install Navi Agent

  3. ============================

chmod 777 /root/install/ESX_install.sh

if http:// ! -f /root/install/naviagent.log ; then

echo "Installing NaviAgent" >/dev/tty2

/root/install/ESX_install.sh naviagentcli \

>/root/install/naviagentcli.log

fi

  1. ======================================

  2. post shell script to enable ftp and nfs and other garp!

  3. ======================================

cat << \EOF > /etc/rc3.d/S99postconfig.sh

#!/bin/sh

/usr/sbin/esxcfg-firewall -e nfsClient

/usr/sbin/esxcfg-firewall -e ftpClient

/usr/sbin/esxcfg-firewall -e swISCSIClient

/usr/sbin/esxcfg-firewall -e sshClient

/usr/sbin/esxcfg-firewall -e telnetClient

/usr/bin/perl /root/install/download.pl

#rm -rf /etc/rc3.d/S99postconfig.sh

EOF

chmod +x /etc/rc3.d/S99postconfig.sh

%vmlicense_texto

Thanks

Mike

0 Kudos
allb18c
Enthusiast
Enthusiast
Jump to solution

Yes, it took about a week for me to figure it out but I am able to run off of % post now.

NOTE: This is very basic, but it should give you the gist of it.

%post --interpreter=bash

  1. Variables

##############

VMKHOSTNAME=%%

VMKIP=%%

VMOTIONIP=%%

VMKDEFROUTE=%%

LOGFILE=%%

ESX_MOUNT=%%

export VMKHOSTNAME VMKIP VMOTIONIP VMKDEFROUTE

  1. Log Header

#

echo " " &gt;&gt; $LOGFILE

echo "Starting Post Procedures " &gt;&gt; $LOGFILE

echo "Starting Post Procedures "

echo "***************************************" &gt;&gt; $LOGFILE

  1. Basic debug info in log file

#

echo "Debug Info:" &gt;&gt; $LOGFILE

ping -c 5 00.00.00.000 &gt;&gt; $LOGFILE

/sbin/ifconfig &gt;&gt; $LOGFILE

/bin/mount &gt;&gt; $LOGFILE

echo "***************************************" &gt;&gt; $LOGFILE

  1. Need an NFS mount to grab the files

#

echo "Start NFS Mount" &gt;&gt; $LOGFILE

echo "Start NFS Mount"

mkdir -p /mnt/tmp

/etc/init.d/portmap start &gt;&gt; $LOGFILE

mount -t nfs -o ro,async,nolock PATH:/to/ISO $ESX_MOUNT &gt;&gt; $LOGFILE

echo "Finish NFS Mount" &gt;&gt; $LOGFILE

echo "Finish NFS Mount"

echo "***************************************" &gt;&gt; $LOGFILE

#

sleep 15

  1. run the top-level post-install script

#

cd $ESX_MOUNT/path/path

./installationscript.sh &lt;----


This script configures the networking and FW ports.

echo "Done Post Procedures " &gt;&gt; /tmp/build.log

Be sure not to place anything in /tmp/ either. The after the installation the reboot wipes anything in this directory. Hope this helps.

0 Kudos
admin
Immortal
Immortal
Jump to solution

mike, a good way to test %post scripts is to do a generic install on a "testing" machine, but don't reboot when installation is finished. instead switch over to TTY2 (Ctrl-Alt-F2), then chroot to /mnt/sysimage (assuming you're not using the --nochroot flag with %post) and type your script in at the prompt. If networking is turned on, you could even scp over your script in file form and run it.

0 Kudos