Set up VirtualBox 5.0 on a Headless CentOS 6 Server

Part 1 of setting up a Linux home lab environment with VirtualBox. Check this blog post for more info.

VirtualBox is a powerful and feature rich x86/AMD64/Intel64 virtualisation product for enterprise as well as home use.


Software used in this article:

  1. CentOS 6
  2. VirtualBox 5


Add VirtualBox repository:

# wget \
 -O /etc/yum.repos.d/virtualbox.repo

Install kernel headers and other dependencies:

# yum install -y binutils gcc make patch libgomp dkms \
 glibc-headers glibc-devel kernel-headers kernel-devel

Install and setup VirtualBox:

# yum install -y VirtualBox-5.0
# /etc/init.d/vboxdrv setup

Download VirtualBox extension pack (v5.0.6) which contains a VRDE module needed for VBoxHeadless:

# wget

Install extension pack:

# VBoxManage extpack install ./Oracle_VM_VirtualBox_Extension_Pack-5.0.6.vbox-extpack
Successfully installed "Oracle VM VirtualBox Extension Pack".

Verify installation:

# VBoxManage list extpacks
Extension Packs: 1
Pack no. 0:   Oracle VM VirtualBox Extension Pack
Version:      5.0.6
Revision:     103037
Description:  USB 2.0 and USB 3.0 Host Controller, Host Webcam, VirtualBox RDP, PXE ROM, Disk Encryption.
VRDE Module:  VBoxVRDP
Usable:       true
Why unusable:

To uninstall extension pack, do:

# VBoxManage extpack uninstall "Oracle VM VirtualBox Extension Pack"


We use a separate 500GB /dev/sdb1 disk mounted on /vb to store VirtualBox images.

Create VirtualBox CentOS Image

Configuration file can be see below:

# cat ./
# written by Tomas (
# 12/04/2014 (dd/mm/yy)
# copyleft free software
# Variables below are passed to VBoxManage
# Modify appropriately
VM="CentOS_6"; #name of the virtual machine
DISKSIZE=64000; #in MB
RAM=512; #in MB

echo "Creating the "$VM" VM."
cd ~;
VBoxManage createhd --filename "$VBROOT"/"$VM"/"$VM".vdi --size "$DISKSIZE";
VBoxManage createvm --register --name "$VM" --basefolder "$VBROOT" --ostype "$OSTYPE";
VBoxManage storagectl "$VM" --name "SATA Controller" --add sata  --controller IntelAHCI;
VBoxManage storageattach "$VM" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$VBROOT"/"$VM"/"$VM".vdi;
VBoxManage storagectl "$VM" --name "IDE Controller" --add ide;
VBoxManage storageattach "$VM" --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium "$ISO";
VBoxManage modifyvm "$VM" --memory "$RAM";
VBoxManage modifyvm "$VM" --boot1 dvd --boot2 disk --boot3 none --boot4 none;
VBoxManage modifyvm "$VM" --chipset piix3;
VBoxManage modifyvm "$VM" --ioapic off;
VBoxManage modifyvm "$VM" --mouse ps2;
VBoxManage modifyvm "$VM" --cpus "$CPU" --cpuexecutioncap "$CPUCAP" --pae "$PAE";
VBoxManage modifyvm "$VM" --hwvirtex off --nestedpaging off;
VBoxManage modifyvm "$VM" --nic1 bridged --bridgeadapter1 "$ADAPTER";
VBoxManage modifyvm "$VM" --vram "$VRAM";
VBoxManage modifyvm "$VM" --monitorcount 1;
VBoxManage modifyvm "$VM" --accelerate2dvideo off --accelerate3d off;
VBoxManage modifyvm "$VM" --audio none;
VBoxManage modifyvm "$VM" --snapshotfolder "$VBROOT"/"$VM"/Snapshots;
VBoxManage modifyvm "$VM" --clipboard bidirectional;
VBoxManage modifyvm "$VM" --usb "$USB";
VBoxManage modifyvm "$VM" --vrde on;
echo "Run 'vboxmanage list -l vms | less' to check configuration."
exit 0;

Run the script to provision a new virtual machine:

# bash ./

Please feel free to check this post:

for more detailed explanation of VirtualBox configuration parameters that we use in this article.

Install Virtual Machine

Start the CentOS VM and bind VirtualBox remote desktop extension server to TCP 8888 port:

# VM=CentOS_6
# VBoxHeadless --startvm "$VM" -e "TCP/Ports=8888" --vrde on

To proceed with CentOS installation, we need to connect with rdesktop/freerdp from a GUI capable machine and follow on-screen instructions:

$ rdesktop <virtualbox_server_ip>:8888

It is recommended to install VirtualBox Guest Additions. They are designed to be installed inside a virtual machine after the guest operating system has been installed. The Guest Additions consist of device drivers and system applications that optimise the guest operating system for better performance and usability and make your life much easier.

4 thoughts on “Set up VirtualBox 5.0 on a Headless CentOS 6 Server

  1. Hi Tomas,

    As part of, you wanted to set up a management server(first guest OS) with two network cards. So one should be NAT and other one is HOST-Only. Will both network cards receive their IP’s via DHCP from virtual box? or only the NAT network card. Could you please explain and if possible write an article on this , so its easy for a starter like me to follow the steps.

    Also i see that variable “$VBOXROOT” used in the script is not defined any where. It could be a typo (VBOXROOT should be “VBROOT”). if yes, please correct it.

    • Hi Sam,

      Yeah, that was a typo, well spotted. I’ve fixed it now.

      With regards to the management server, you are right, one NIC is for NAT, and another NIC is for Host-only. Now to answer your DHCP question, the NAT’ed interface will automatically receive configuration from a DHCP server integrated into VirtualBox.

      The Host-only card can receive a DHCP lease if you have your network adapter configured with a DHCP server. In my case the DHCP server on the Host-only adapter is disabled, because I use a DHCP server that is configured on the management server. All DHCP leases on the Host-only network are issues by the management server and not by VirtualBox.

  2. What did I mess up?
    VRDE server is listening on port 8888.
    Error: failed to start machine. Error message: Failed to open/create the internal network ‘HostInterfaceNetworking-eth0’ (VERR_INTNET_FLT_IF_NOT_FOUND).
    Failed to attach the network LUN (VERR_INTNET_FLT_IF_NOT_FOUND)

    • Check the VirtualBox error log, it should have more info. Might be a problem with bridging/network drivers. Try NAT’ed network interface and see if that makes a difference.

Leave a Reply

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