I know this is an old question, but I searched all over the internet for a solution to this and I couldn't find anything quite as comprehensive as what I'd like to share.
Yes, it's possible to use vmware player as a service for Linux (there's a separate answer for Windows); it's easy and there's no reason I can think of not to do it. It's especially great for hosting a headless server from a headless server.
The other VMware-oriented choice, VMware Server, is deprecated and the only other $0 choice I know of is VirtualBox. If you like that better than VMWare Player, more power to you, but I know VMWare Player and I don't see a reason not to use a well-supported path to get what I want.
Presumably you'll want it to run under a non-root account and start up and shut down at the standard service startup/shutdown times. If that's the case, then here's how to configure it:
Get the daemon package (usually not installed by default):
apt-get install daemon
Download VMware Player and VMware VIX from vmware.com and install them to get the VM engine and VIX's vmrun (command-line control of vm execution) binary.
Add the service to the startup by creating
/etc/init.d/<vm_server_name>. It could look something like this:
### BEGIN INIT INFO
# Provides: vm_server_name
# Required-Start: $named $remote_fs $syslog
# Required-Stop: $named $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: My Server VM
# Description: Virtual Machine instance of My Server
### END INIT INFO
if [[ "$USER" == "$USER_TO_RUN_UNDER" ]]; then
case "$1" in
daemon $USER_FLAG -- vmrun -T player start "$VM" nogui &>/dev/null &
vmrun -T player suspend "$VM" &>/dev/null
while [[ "$(vmrun -T player list | grep -o "$VM")" == "$VM" ]]; do
echo "Usage: $0 start|stop" >&2
Make the script runnable:
chmod a+x /etc/init.d/vm_server_name
Add the script to the standard linux service startup/shutdown runlevels. The numbers ensure that it is one of the last things started and the first to be shut down:
update-rc.d vm_server_name defaults 99 01
- You'll probably need to 'sudo' all the commands as you're modifying root-owned files.
- I put a loop in so that on shutdown the script doesn't return to the OS until it has completely suspended the guest OS. I don't know if that's needed or not, but it seemed like a good idea. It will definitely slow down shutdown of the host OS, but it is worth it in my opinion.
- If you need to interact with the local GUI of the guest OS, suspend the server by running
/etc/init.d/vm_server_name stop and then start it locally using the VMware player GUI. After finishing, suspend it and run
/etc/init.d/vm_server_name start to start the headless instance again.