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.7
  2. VirtualBox 5.0.6


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 Nevar (
# 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 "$VBOXROOT" --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.

Leave a Reply

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