VMware Player - Running as a Service
Solution 1
Vmware Server is the correct tool for running a VM in the background, not Vmware Player.
Solution 2
Sorry for the late responce with this. I was trying to figure this out today. I came across this answer, figured I let SF know.
You can actually ...
-
Add this to your VMX config file to set VMWare Player not show the UI:
msg.noOk = "TRUE"
Get instsrv.exe from a Windows Server Resource Kit to create your own service
On Startup have a batch file call the service you just made
Step-by-step instructions can be found here:
http://research.stowers-institute.org/dct/docs/admin/VMwarePlayerService.htm
Solution 3
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:#! /bin/bash ### 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 PATH=/sbin:/usr/sbin:/bin:/usr/bin VM="/path/to/vmx_file.vmx" USER_TO_RUN_UNDER="username" if [[ "$USER" == "$USER_TO_RUN_UNDER" ]]; then USER_FLAG="" else USER_FLAG="--user=$USER_TO_RUN_UNDER" fi case "$1" in start) daemon $USER_FLAG -- vmrun -T player start "$VM" nogui &>/dev/null & ;; stop) vmrun -T player suspend "$VM" &>/dev/null while [[ "$(vmrun -T player list | grep -o "$VM")" == "$VM" ]]; do sleep 1 done ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac
-
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
Notes:
- 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.
Related videos on Youtube
Neil Foley
Updated on September 17, 2022Comments
-
Neil Foley almost 2 years
Is it possible to run VMware player as a Windows Service so that a user does not have to be logged in to have the player running?
-
Chris_K over 14 years(and is also free)
-
JamesBarnett over 12 yearsNot strictly true. People all over the net are running VMWare Player as a service.
-
Rob Moir over 12 years@JamesBarnett people do lots of things that aren't "ideal" - go for a drive and watch how others behave on the roads if you don't believe me. The fact that you can 'bodge' VMWare player into running as a service doesn't alter the fact that VMWare server is the intended tool for that job.
-
JamesBarnett over 12 yearsMaybe depends on the use case. If you want to run a VM unattended because you want a cheap VMWare Server then I agree with you. However the statement "the correct tool for running a VM in the background" is overly broad. In my case, I wanted to run linux side-by-side with Windows using Unity mode and not have to worry with seeing the VMWare Player UI. Also Windows is overly found closely binding GUIs with background processes. A central part of computer history is being able to hack a something to do what you want. The tool isn't wrong, you just need to know it's limitations.
-
Zoredache over 12 yearsOTOH, keep in mind that this site is about professional sysadmining.
-
JamesBarnett over 12 years@Zoreache LOL. Runnung a VM in the background is a built-in feature to VMWare Workstation since atleast version 6.
-
Sirber over 12 yearsvmware server is deprecated and has a low "vm hw version"
-
Zoredache over 11 yearsIf Vmware player, and Virtual box are the only thing you came up with on Linux, then you aren't searching very hard. KVM and Xen are the preferred tools these days.
-
David Gladfelter over 11 yearsOops, I didn't see the word 'Windows' in the question.
-
David Gladfelter over 11 yearshmm, on second thought I think windows wasn't mentioned in the question when I answered it. Could be wrong...
-
Roy over 11 years-1 Technically, the question is whether VMware Player can be run in the background, not which alternatives are available that may or may not be more ideal.
-
user1734102 almost 9 yearslast link is broken