, , , , , , ,

VirtualBox is a virtualisation software.

To set up VirtualBox on Debian, we’ll need to add the VirtualBox’s repository into our sources.list. To get their latest release, go to https://www.virtualbox.org/wiki/Linux_Downloads. Make sure that the proxy server for apt-get and wget is configured. ( /etc/apt/apt.conf, /etc/wgetrc )

nano /etc/apt/sources.list


Add the http link that can be retrieved from the website stated above. I’m using Debian Squeeze, so I’m going to add the Debian Squeeze’s line.

deb http://download.virtualbox.org/virtualbox/debian squeeze contrib non-free


Add the VirtualBox’s public key and install the required packages.

wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
apt-get update
apt-get install virtualbox-4.1 dkms linux-headers-$(uname -r) build-essential


To run a headless VM, we’ll need to also install the extension pack. First we’ll need to go to the tmp directory and download the installation file from VirtualBox’s website.

cd /tmp
wget http://download.virtualbox.org/virtualbox/4.1.8/Oracle_VM_VirtualBox_Extension_Pack-4.1.8-75467.vbox-extpack
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.1.8-75467.vbox-extpack


Once the extension pack is installed, add the user that you want to use to administrate the virtual machines to the virtualbox group

adduser administrator vboxuser


To rip an ISO to a local directory.

dd if=/dev/cdrom of=/srv/debmirror/ISO/debian.iso


The following lines will create a virtual machine with

  • name: vm-debian1
  • ram: 512mb
  • boot from: dvd
  • nic: bridge to eth0
  • rdp port: 5001
  • harddisk: vm-debian1.vdi, size 10gb
  • IDE controller: IDE Controller
  • IDE port 0 dev 0: hdd
  • IDE port 0 dev 1: dvd mounted to ripped ISO on /home/debian.iso
VBoxManage createvm --name "vm-debian1" --register
VBoxManage modifyvm "vm-debian1" --memory 512 --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 eth0 --vrde on --vrdeport 5001
VBoxManage createhd --filename vm-debian1.vdi --size 10000
VBoxManage storagectl "vm-debian1" --name "IDE Controller" --add ide
VBoxManage storageattach "vm-debian1" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium vm-debian1.vdi
VBoxManage storageattach "vm-debian1" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium /srb/debmirror/ISO/debian.iso


We can use VBoxManage –help to view the various commands and parameters that you can implement.

To list the created VMs

VBoxManage list vms


To list the running VMs

VBoxManage list runningvms


To start the VM

VBoxHeadless --startvm "vm-debian1"


For more commands to control your VMs, do a VBoxHeadless –help.

Once the VM is started, we can now use a Windows client in the network to RDP in using the host’s ip address and the listening vrde port.