Wednesday, July 9, 2014

How to modify templates that do not work with the VMware customization wizard

Some RedHat templates, do not work with the Vmware customization wizard.  For example everything under RHEL 5.6, you will get an error like this:




Clone virtual machine XXXXX-09 
Customization of the guest operating system 'rhel5_64Guest' is not supported in this configuration. Microsoft Vista (TM) and Linux guests with Logical Volume Manager are supported only for recent ESX host and VMware Tools versions. Refer to vCenter documentation for supported configurations.



So what you want to do now if you are creating 40 VM's or a number of them, is create them all from the template you're using, either by doing it through the GUI and choosing no customization such as below:

Or the way I do it is through PowerCLI using this line (or lines)

New-vm -vmhost host15.domain.com -Name VM-RHEL5.6-01 -Template template-rhel56-64bit -Datastore datastore-NetApp1

It would then look like this:


(in the example above, I put 7 of these lines in a powerCLI script)

After the VM's are created, I would put them into folders and then modify CPU/Memory as well as vlan if needed such as below:

CPU/MEMORY:
get-vm -Location "SOMEFOLDER" | set-vm -MemoryGB 4 -NumCpu 2 -confirm:$false 

Network (Portgroup)
get-vm -Location "SOMEFOLDER"  | Get-NetworkAdapter | Set-NetworkAdapter -NetworkName "dvPort-vlan101-public-web" -confirm:$false 

Now lastly comes the Linux part, where since these templates have an interface which is configured for DHCP.  If you have a DHCP server and you can see the IP address, then you can just SSH to the VM and change what you need.  However in our case these do not get an IP and so we need to get on console and change things, as below:

Power the VM's on, then go to the console, log in and issue this command:

# system-config-network

You will then get a screen like this:


You then press enter, go into "Edit Devices" then the device you want, such as eth0, and you will get a screen like this:


You then press the space bar to remove the asterisk from the "Use DHCP" and put in the IP address,
after which you go out, saving the changes, and then issue a:

#service network restart

Afterwards, SSH in, or do it in the console, edit /etc/hosts, change the name of the VM, /etc/sysconfig/network, and /etc/resolv.conf and anything else you need to do.  (Change password, change ntp.conf etc)

You could also make all these changes to the file /etc/sysconfig/network-scripts/ifcfg-eth0 vs. doing it using the Redhat wizard shown above.



No comments:

Post a Comment