Headless VirtualBox

Sometimes I need to run a headless VirtualBox VM.

Here’s a couple scripts to build one up and get one running with VNC access:

root@colinbsd:/prodVMs # cat makeOpenProj
VBoxManage createvm –name openproject –ostype FreeBSD_64 –register

VBoxManage modifyvm openproject –memory 2048 –ioapic on –cpus 4 –chipset PIIX3 –nic1 bridged –nictype1 82540EM –bridgeadapter1 bge0

VBoxManage createhd –filename openproject.vdi –size 20480

VBoxManage storagectl openproject –name “SATA Controller” –add sata –controller IntelAhci

VBoxManage storageattach “openproject” –storagectl “SATA Controller” –port 0 –device 0 –type hdd –medium openproject.vdi

VBoxManage storagectl openproject –name “IDE Controller” –add ide –controller PIIX4

VBoxManage storageattach openproject –storagectl “IDE Controller” –port 1 –device 0 –type dvddrive –medium fbsd.iso

VBoxManage modifyvm piwik –boot1 dvd


root@colinbsd:/prodVMs # cat startOpenProj
VBoxHeadless –startvm openproject –vrde on -e TCP/Ports=5001 -e VNCPassword=”vncpassword” &


Then you might want to change the boot medium to not the dvd…:

root@colinbsd:/prodVMs # VBoxManage controlvm openproject poweroff

root@colinbsd:/prodVMs # VBoxManage modifyvm openproject –boot1 disk

root@colinbsd:/prodVMs # ./startOpenProj

Leave a Reply

Your email address will not be published. Required fields are marked *