Virsh is my favorite cmdline for KVM management. You may wonder if there is sth similar for VMware or want to run VMware without GUI. Here is goes – vmrun.
0. VIX API
VIX API allows users to automate the management of VMs, such as APIs used to start/stop VMs. It supports most products from VMware, including Player, Sever, Workstation, Fusion and vSphere (though VIX API is deprecated as there is a vSphere API).
After VIX API is installed, you will have a powerful command – vmrun, which leverages the powerful VIX API to provide a similar command line interface for VMware-based VMs, like virsh for KVM.
Take VMware Player and its VMs for example:
# Start the VM without GUI
vmrun -T player start “path/to/yourVM.vmx” nogui
# Stop the VM
vmrun -T player stop “path/to/yourVM.vmx” hard
# List all possible commands supported by vmrun
There is a command in vmrun – getGuestIPAddress, which is used to get the IP address of the guest VM. First, the VM needs to be started. Second, VMware tools are needed to make the functionality work.
Once you login the VM, you may find top does not work. The same case happens if you try to compile the kernel (make menuconfig). Adding the fix into .profile helps.
‘xterm-256color’: unknown terminal type.
Fix: export TERM=xterm