The same things that make VirtualBox appealing make it less so: it's a very simple program to install, even deviating from Debian conventions. It takes only 30MB of space and everything can be tucked neatly away in /opt/VirtualBox, only to be accessed through $PATH and $LD_LIBRARY_PATH when needed. Everything can be command-line oriented: no web access that requires Java or ActiveX, and it's MUCH more intuitive than Citrix XenServer. It also doesn't require VT on the chip, which is a hard requirement for Citrix's Xen product. That said, running VMs as one would with VMware Server, or ESX, is a bit daunting. To accomplish this goal I created start/stop scripts that adapt to the VMs I have installed on the system. The script requires a "vboxmgr" account that owns all of the VMs, so give it a nice shell, like BASH.
#!/bin/sh
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/VirtualBox
export LD_LIBRARY_PATH
if [ "$USER" != "vboxmgr" ]; then
su vboxmgr -c "$0 $1"
else
PATH=${PATH}:/opt/VirtualBox
export PATH
case "$1" in
start)
VBoxManage list vms | while read LINE
do
UUID=`echo $LINE | awk -F'{' '{print $2}' | awk -F '}' '{print $1}'`
if [ "$UUID" != "" ]; then
NAME=`echo $LINE | awk -F'{' '{print $1}'`
echo "Starting the $NAME vm...\c"
# There could probably be better error checking here.
VBoxHeadless --startvm $UUID > /dev/null 2>&1 &
echo "done."
fi
done
;;
stop)
# This is a hard crash! Something better could be done?
VBoxManage list runningvms | while read LINE
do
UUID=`echo $LINE | awk -F'{' '{print $2}' | awk -F '}' '{print $1}'`
if [ "$UUID" != "" ]; then
NAME=`echo $LINE | awk -F'{' '{print $1}'`
echo "Stopping the $NAME vm...\c"
VBoxManage controlvm $UUID acpipowerbutton > /dev/null 2>&1
sleep 30 # Just to be safe...
VBoxManage controlvm $UUID poweroff > /dev/null 2>&1
echo "done."
fi
done
;;
*)
echo "Usage: /etc/init.d/vboxstartvms (start|stop)."
echo "Note: You must have a vboxmgr account! It should be a member of"
echo "the vboxusers group. This user will run all VMs!"
;;
esac
fi