Notice: Undefined index: order_next_posts in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 194

Notice: Undefined index: post_link_target in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 195

Notice: Undefined index: posts_featured_size in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 196

Build a headless virtualisation server

Use VirtualBox on a headless server to create and manage remote virtual machines that can be accessed from anywhere

Virtual Machine VM qemu

Virtualisation tools are now pretty much ubiquitous. This is thanks to current technology and the power of modern computing allowing for host-like performance with the right setup. And, of course, virtualisation is especially useful in the cloud. Whether you’re testing distros, software compatibility, or any number of other tasks, a virtual machine can help you make the most of your time.

While host performance is not too difficult these days, it can still take a toll on the host system if you’re wanting to multitask. You also may not have the resources on your main PC to get decent performance, let alone host. If you have access to a powerful server, though, and want to take advantage of this resource, you can set it up to run virtual machines from the terminal.

Using headless VirtualBox over SSH, you can easily install, modify and run virtual machines which you can then connect to via RDP. You can even manage them via a web interface to make the process a little more human. A lot of these commands will work for any machine, so if you like to do as much as possible in the terminal, you can pick up a few tips from this tutorial.

Step by Step

Virtual Machine VM qemu
Download VirtualBox

Step 01

Virtual Install

Install VirtualBox to your server.
The website offers binaries for most major distributions, and some distros have it in the repository. For Debian-based distros, you may have to add the official Virtual Box repo:

deb virtualbox/debian [distro] contrib

…with ‘[distro]’ replaced by your version of Ubuntu, eg ‘precise’.

Step 02

Virtual Extensions

It’s best to get the extensions set up now. Download them using wget:

$ wget

Make sure it’s the latest version, and that it matches up with the version you have.

Step 03

Extension install

Once that’s downloaded, you can unpack it and install it to VirtualBox using this command:

$ sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack- 4.1.22-80657.vbox-extpack

Again, make sure you use the correct version of your extension pack that you downloaded.

Step 04

Add User

We’ll need to add the relevant user to the VirtualBox user group. To do this we have to use something like this:

sudo adduser administrator vboxusers

…where ‘administrator’ is the user you’ll be connecting to the headless server with.

Step 05

Virtual create

To begin with, we’re going to be using the VboxManage tool to start creating and modifying virtual machines. Our first command will be:

$ VBoxManage createvm --name “Name of VM Here” --register

In our example we’re going to be using a Fedora virtual machine.

Step 06

Virtual modify

We’re going to now add some system information for the VM:

$ VBoxManage modifyvm “Fedora 17” --memory 1024 --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 eth0

We’re setting the memory to 1024MB above, as well as setting the boot priority to disc first.

Step 07

Virtual storage

Time to set up a virtual hard drive for our new VM to use. Create it using a command like this:

$ VBoxManage createhd --filename Fedora_17.vdi --size 10000

…where 10000 is the amount of storage in megabytes, so roughly 10GB in this example.

Step 08

Virtual IDE

The hard drive needs to be attached to the VM, and to do this the VM needs to have an IDE controller attached to it. We add one like this:

$ VBoxManage storagectl “Fedora 17” --name “IDE Controller” --add ide

We can also use this to add a virtual optical drive for the installation medium.

Step 09

Virtual attach

Attaching the hard drive requires a little more info than just pointing it towards the VDI:

$ VBoxManage storageattach “Fedora 17” --storagectl “IDE Controller”
 --port 0 --device 0 --type hdd --medium Fedora_17.vdi

The ports and type are important to remember when adding further virtual devices.

Step 10

Virtual DVD

Finally, attach the installation medium to your virtual machine:

$ VBoxManage storageattach “Fedora 17” --storagectl “IDE Controller”
 --port 1 --device 0 --type dvddrive --medium fedora17.iso

Port 1 is the first port after the hard drive.