Step by Step: Creating a Virtual Machine on a Headless Server

The following instructions describe how to create a virtual machine on a headless server over a network connection. This example creates a virtual machine, establishes an RDP connection and installs a guest operating system. All of these tasks are done without having to touch the headless server. You need the following prerequisites:

Note that on the server machine, since we will only use the headless server, Qt and the X Window system are not required.

  1. On the headless server, create a new virtual machine. For example:

    VBoxManage createvm --name "Windows XP" --ostype WindowsXP --register

    If you do not specify --register, you will have to manually use the registervm command later.

    You do not need to specify --ostype, but doing so selects some sensible default values for certain VM parameters. For example, the RAM size and the type of the virtual network device. To get a complete list of supported operating systems you can use the following command:

    VBoxManage list ostypes
  2. Ensure the settings for the VM are appropriate for the guest operating system that we will install. For example:

    VBoxManage modifyvm "Windows XP" --memory 256 --acpi on --boot1 dvd --nic1 nat
  3. Create a virtual hard disk for the VM. For example, to create a 10 GB virtual hard disk:

    VBoxManage createhd --filename "WinXP.vdi" --size 10000
  4. Add an IDE Controller to the new VM. For example:

    VBoxManage storagectl "Windows XP" --name "IDE Controller"
      --add ide --controller PIIX4
  5. Set the VDI file you created as the first virtual hard disk of the new VM. For example:

    VBoxManage storageattach "Windows XP" --storagectl "IDE Controller"
     --port 0 --device 0 --type hdd --medium "WinXP.vdi"
  6. Attach the ISO file that contains the operating system installation that you want to install later to the virtual machine. This is done so that the VM can boot from it.

    VBoxManage storageattach "Windows XP" --storagectl "IDE Controller"
     --port 0 --device 1 --type dvddrive --medium /full/path/to/iso.iso
  7. Enable the VirtualBox Remote Desktop Extension, the VRDP server, as follows:

    VBoxManage modifyvm "Windows XP" --vrde on
  8. Start the virtual machine using the VBoxHeadless command:

    VBoxHeadless --startvm "Windows XP"

    If the configuration steps worked, you should see a copyright notice. If you are returned to the command line, then something did not work correctly.

  9. On the client machine, start the RDP viewer and connect to the server. See for details of how to use various common RDP viewers.

    The installation routine of your guest operating system should be displayed in the RDP viewer.