vCenter is really straightforward for tasks like cloning a server image. ESXi, however, is rather spartan when it comes to features. Many management tasks can still be performed with command line interface by using a tool like PuTTY.
You just got a new bare metal server and you want to setup VMware ESXi and vCenter but a prerequisite for installing vCenter is a configured domain. If you are working in an environment without a Domain Controller then you will have to configure a VM to be a DC on your VMware ESXi host and setup a domain before you can install vCenter. Once vCenter is installed most management tasks are quite easy to accomplish with vSphere.
My endpoint goals:
- Virtualize a physical server
- Install ESXi on bare metal host
- Install vCenter to manage VMs
The author assumes you have installed VMware ESXi 5.x or 6.x hypervisor on your host server and configured the basic parameters like IP address, subnet, gateway and host name. Outline of steps to create a master VM image:
- Create a VM
- Install OS
- Install VMware tools
- Update OS with the latest updates
- Install any apps you want on the master image
- Configure any settings you prefer on all your servers
- Follow steps below to clone
Steps to clone VM using only the bare metal install of ESXi:
Take a snapshot of the server you would like to use as the master image
Enable SSH on the host. Select the host > go to Configuration tab > Security Profile > Properties
Scroll down > select SSH > click Options
Start the service, you can stop it later to minimize security risks.
Download PuTTY and open it to establish an SSH connection. Input the IP address of your host to connect. In my case the host IP is 192.168.1.3. Enter the root username and password in PuTTY to login to the host.
Navigate to your master VM to verify it is the location you expect by running these commands in PuTTY:
Create a Directory called Clone to store clone images.
If your snapshotted source VM is “DC1” located on “datastore1” the following is the command to clone the VM called DC1. The “-000001” suffix on the VM name is to capture a snapshot version. If there was no snapshot you could just have “DC1.vmdk” at the end of the source path. Paste this entire command as one piece:
vmkfstools -i /vmfs/volumes/datastore1/DC1/DC1-000001.vmdk /vmfs/volumes/datastore1/Clone/VC1.vmdk -d thin
“Clone” is the folder where it will be stored and “VC1” is the name of the cloned virtual disk. “-d” is for the disk format, in this case thin provisioned. We will now create a new VM in vSphere and use the existing virtual disk.
Create a new VM in vSphere
Name the VM
Select the target datastore
Select the guest OS, in my case Server 2012 R2
The default is 1 NIC, which is fine but I prefer to add a second internal NIC for VM to VM traffic that I previously setup
Put whatever you want here because you will be deleting it anyway so you can add the cloned VD you already saved
Select Edit the virtual machine before you continue
In the Edit window, select the “New Hard Disk” you just entered parameters for and select Remove
Select Hard Disk
Select Use an existing virtual disk
Browse to your Clone folder in the appropriate datastore, for me it was datastore1
Next > Next > Finish
Hooray, you have just created a cloned VM using command line!
Hope this helps!