Run VirtualBox in background, without a window?
Solution 1:
VBoxManage startvm $VM --type headless
will start the specified virtual machine in the background.
To shut it down, request the shut down from the guest.
Solution 2:
This is built into VirtualBox 4.2.
Simply hold down Shift when launching the VM from the Manager.
https://blogs.oracle.com/fatbloke/entry/what_s_new_in_oracle
Solution 3:
Absolutely! You are looking for a headless installation (Virtualbox). The way to start the machine from the command line is something like:
VBoxHeadless --startvm Debian --vrdp=off
However you will need some way to connect. What I do is mapping ports between guest and host. With this configuration, your host 2222 port will be mapped to port 22 of your guest machine.
VBoxManage setextradata "Debian" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
VBoxManage setextradata "Debian" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22
VBoxManage setextradata "Debian" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222
After that you can log in with:
ssh localhost -p2222
Solution 4:
an alternative to VBoxManage startvm "{VMName}" --type headless
isVBoxHeadless -startvm "{VMName}"
Amusingly enough, I just finished figuring out how to run a VM headless, over RDP.
Note - At least on windows, it will block your command window. If you need to continue using your console window, open another to start the VM in.
To shut the VM down, you request the Guest OS to shutdown. VBoxHeadless
releases the console when the Guest is fully shut down (You can Ctrl+C
, but I think it may be analogus to a hard reset on a real machine).
Solution 5:
I'm using VBoxTool from http://vboxtool.sourceforge.net/ and it works perfectly for me. It can autostart VMs at boot and stop/save VMs at shutdown and provides a simple clean command line interface.