21 September 2014

Create Redhat Enterprise Linux Template VM in VMware vCenter

You can create a RHEL template VM in your VMware ESXi environment in order to make new VM deployment easier and faster.

You fisrt need to create a normal VM and install your RHEL inside it. You can also install other applications that you may need to have them in all your new VM employments.

After You are done with your installation and configuration of the VM that suppose to be used as Template, we need to carry following task inside guest OS before proceed to convert it to a VMware Template.

1. Flag the system for reconfiguration:

# touch /.unconfigured 

2. Deactivate all the network cards of your VM: 

example for eth0:

# ifdown eth0

Remove the HWADDR entry from the ifcfg-eth* files:

# vi /etc/sysconfig/network-scripts/ifcfg-eth0


and activate you network cards again:

# ifup eth0

3. You need to delete entries regarding the network cards from 70-persistent-net.rules file as well:

# vi /etc/udev/rules.d/70-persistent-net.rules

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:b7:3b:f7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

Remove the lines started with SUBSYSTEM, save and exit the file. 

4. Delete any SSH host keys:

# rm -rf /etc/ssh/ssh_host_*

And that's it, just remember to Shutdown or power off your VM immediately before you change any settings. It is now ready to be converted to a Template. 

Note: If you happen to reboot your system, you need to repeat the step 3 and power off your VM, 

Now, from the vCenter, right click on your VM and go to Template > Convert to Template.

Once it's ready, you can right click on your newly created Template and choose Deploy Virtual Machine from This Template. Follow on screen dialogues, give hostname and choose the location for your new VM. 

And there you go, you have your  new VM created without hassle of installing and configuring OS and applications each time you want a new server. 

1 comment:

  1. I admire the valuable information you offer in your articles. I will bookmark your blog and have my friends check up here often. I am quite sure they will learn lots of new stuff here than anybody else! Regards, vmware jobs in hyderabad