VMWare Guide.txt - Notepad

VMWare Guide

How to install VMware Player

To download VMware Player, go to http://www.vmware.com/go/downloadplayer/ and click on Download.
Then open a terminal and run the following command to install some packages needed by the VMware Player installer:

sudo apt-get install build-essential linux-headers-`uname -r`
Then go to the location where you saved the VMware Player file.
We can start the VMware Player installation as follows:
gksudo bash ./VMware-Player-3.1.4-385536.x86_64.bundle
This will start the graphical VMware Player installation wizard. Just click your way through it.

The closest equivalent would probably be to install the below packages:
yum install make automake gcc gcc-c++ kernel-devel

However, if you don't care about exact equivalence and are ok with pulling in a lot of packages you can install all the development tools and libraries with the below command.
yum groupinstall "Development Tools" "Development Libraries"

If you already have all the required dependencies, a simple install method is to download the install file, type chmod +x vmware_file and then move to the directory containing the file and type ./wmware_file to kick off the install.

How to give a VM its own virtual IP address

Open VMWare Player, select Virtual Machine Settings, select the network card, under network connection select Bridged: Connected directly to the physical network and tick the checkbox Replicate physical network connection state.

How to run a VM from the command line using VMWare Player

For both Linux and Windows host versions, the syntax is "vmplayer path-to-your-vm.vmx" and that will load and run the given VM.

How to extend the virtual disk space of a VM

Open VMWare Player and select the VM from the inventory. Select Virtual Machine Settings, select your hard disk, click Utilities > Expand. Enter the new disk size and then click expand. Note, you will also need to expand the disk on the VM using something like Disk Management for Windows or Gparted for Linux.

Using VMrun to send commands to VMWare Player

You will need to install VMware VIX API from the VMWare website to make these commands work with VMWare Player.
vmrun -T player list - show all running VMs.
vmrun -T player start /vmware/vm.vmx - start a VM in GUI mode.
vmrun -T player start /vmware/vm.vmx nogui - start a VM without a GUI, can be executed from run level 3 on the host.
vmrun -T player stop /vmware/vm.vmx soft - poweroff a VM, the soft tag asks it nicely, leave it off to force a shutdown.
vmrun -T player reset /vmware/vm.vmx soft - reboot a VM, can be done without the soft tag.

Copying the VM folder

It is possible to backup your VMs by copying the entire VM folder. However, if you copy the folder while the VM is running, or if you overwrite an existing VM folder, the VM will not run.

Unable to connect to guest console in vSphere

Launching a virtual machine console from the vSphere Web Client or vSphere Client fails with one of these errors:
Unable to connect to the MKS: Could not connect to pipe \\.\pipe\vmware-authdpipe within retry period.
Unable to connect to MKS: internal error

This issue occurs because an ESXi host is not placed in maintenance mode before migrating to a different vCenter Server.

To work around this issue, refresh the VMX/MKS SSL cache on the virtual machine by migrating the virtual machine to another ESXi host.

Default location of Vcentre logs

c:\ProgramData\VMware\VMware VirtualCenter\Logs\vpxd-xxxxx

How to kill a VM using the esxi CLI

SSH as root to host
esxcli vm process list
esxcli vm process kill -t [soft,hard,force] -w insert_world_number

ESXi 6.7

Power state commands:

vim-cmd vmsvc/power.shutdown vmid

vim-cmd vmsvc/power.off vmid

vim-cmd vmsvc/power.on vmid

Unregister VM ie delete VM from vsphere, but keep all files ie vmdk, vmx etc.

vim-cmd vmsvc/unregister vmid

Delete a VM from vsphere AND delete its storage:

vim-cmd vmsvc/destroy vmid

Show all registered VMs and where their primary disks are stored:

vim-cmd vmsvc/getallvms

How to backup a VM and restore it

Power off the VM.

Copy it a new location:

cp -rv /vmfs/volumes/source_datastore/vm1/* /vmfs/volumes/destination_datastore/vm2/

Rename the VM:

vmkfstools -E /vmfs/volumes/destination_datastore/vm2/vm1.vmdk /vmfs/volumes/destination_datastore/vm2/vm2.vmdk

Rename the vmx config file to the new vm name:

mv /vmfs/volumes/destination_datastore/vm2/vm1.vmx /vmfs/volumes/destination_datastore/vm2/vm2.vmx

Rename filename and displayName to the new VM name ie vm2:

vi /vmfs/volumes/destination_datastore/vm2/vm2.vmx

Register the VM in vsphere:

vim-cmd solo/registervm /vmfs/volumes/destination_datastore/vm2/vm2.vmx

Backup a thick provisioned VM disk as thin, can save you space!

vmkfstools -i /vmfs/volumes/source_datastore/vm1/vm1.vmdk -d thin /vmfs/volumes/destination_datastore/vm2/vm2.vmdk