The following article highlights how to setup a machine in Virtual Box 4, allowing remote access via VDRP.
I assume that you have already installed VirtualBox 4 (or the latest version) on your system. Virtualbox-OSE is not able to use features like USB host pass through and remote administration, so make sure you’ve installed the full version of VirtualBox from their website and installed it using: dpkg –install virtualbox-4.0_4.0.8-71778~Ubuntu~natty_i386.deb
http://www.virtualbox.org/wiki/Downloads
You MUST also install VirtualBox Oracle VM VirtualBox Extension Pack that can be found on the downloads page above
Create your first VM
VBoxManage createvm –name centos –register
This creates a VM named centos and registers it with the VBox manager
Setup Memory, Boot Device, etc
VBoxManage modifyvm centos –memory 256 –acpi on –boot1 dvd
You can modify the spec of your VM using the modifyvm flag. This sets it’s memory to 256MB, enables acpi and sets the boot device to the DVD drive
Create the VDI (Hard Drive)
sudo VBoxManage createvdi –filename “/var/vbox/centos.vdi” –size 5000
You may need to use sudo if you’re in Ubuntu. This command creates the hard drive for the machine in a directory you specify. You can also set it’s size in MegaBytes, this drive is 5GB
Setup an IDE controller
VBoxManage storagectl centos –name “IDE Controller” –add ide
It’s also necessary to configure the VM with a storage controller, in this case I’ve called it IDE Controller and set the type to IDE
Set the VM to use the new VDI
VBoxManage modifyvm centos –hda “/var/vbox/centos.vdi”
We now need to add the hard drive to the VM. It’s important that you have setup the IDE controller before you do this as it will throw up errors without one. Make sure you get the path to your VDI correct and that it has the correct permissions to allow Virtual Box to read, write and execute.
Setup a DVD drive
VBoxManage storageattach centos –storagectl “IDE Controller” –port 1 –device 0 –type dvddrive –medium /home/user/iso/CentOS-5.6-i386-netinstall.iso
Setup the VM to use the IDE controller on a different port with the type DVD Drive and use an iso image… you can also specify a disc drive, but for my setup there will be a number of ISO’s for people to select and install.
Enable Virtual Remote Desktop Environment (VRDE)
VBoxManage modifyvm centos –vrde on
Simply enables the VRDE to run.
Start the Headless VM
VBoxHeadless –startvm centos -e “TCP/Ports=3389″
This starts the VM in headless mode with VRDE listening on port 3389.
Connect using MSTSC
You can now connect to the machine using MSTSC on Windows or rdesktop on Linux. To connect you need to use the VM HOST’s IP address, not the VM’s IP address.