Ubuntu – Installing VirtualBox on 7.04 Server edition for VRDP use

Aim: to install a command line system, using the 7.04 server edition, and then to install Virtualbox on it, so that I can run VMs using VRDP and access them remotely using rdesktop on client machines.

PART I
Installing the 7.04 server edition is easy, so I’ll skip that.

PART II
Installing VirtualBox is much more difficult, but I got it done in the end as follows. But what I want to know is if there is a better way to do this, e.g. install a desktop 7.04 and strip it back, or reduce all the items I had to install. Not had a chance to do extensive testing on all the variations.

If you are running a headless server, login via ssh (you may need to install openssh-server after the initial install), if not work from the command line at the PC

first off, install lots of kernel/sources stuff
###install needed linux components

sudo apt-get install linux-source
sudo apt-get install make gcc build-essential
sudo apt-get install xen-headers #[choose the version you need, in this case – 2.6.19-4-server]
sudo apt-get install xen-headers-2.6.19-4-server
sudo apt-get install linux-headers-$(uname -r)

#Bridging Utilities
If you are planning on bridging your network interface, install these two packages as well

sudo apt-get install bridge-utils
sudo apt-get install uml-utilities

###install virtualbox (may fail at this stage)

sudo nano /etc/apt/sources.list #[add vbox repository]
deb http://www.virtualbox.org/debian feisty non-free #[add this line and save file]
wget http://virtualbox.org/debian/innotek.asc
sudo apt-key add innotek.asc
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install virtualbox

(you will be asked to install loads of dependencies as well)

###Picked this section up from virtualbox.org forums, as applied to Debian Etch – credits “Ingo”
(on a second attempt at this with a fresh server install, I did not need any of this section)

cd /usr/src
sudo adduser tim src
sudo tar -xvjf linux-source-2.6.20.tar.bz2
sudo ln -s linux-source-2.6.20 linux
sudo cp /boot/config-$(uname -r) linux/.config
cd linux
sudo make oldconfig
sudo make vmlinux
sudo make oldconfig && make prepare (optional?) if above doesn’t work!

#####retry setup of virtualbox if necessary

sudo /etc/init.d/vboxdrv setup

you may need to try compile again if it doesn’t work first time (credits bohdi zazen :))

and it should successfully compile and load vboxdrv.

You then need to add your username to vboxusers (you should have got a warning) :

sudo adduser username vboxusers

I also added myself to the uml-net group in the same way, due to my tap interface setup. You shouldn’t need to do this if you are simply using NAT
(If you haven’t installed uml-utilities this group won’t be there :))

sudo adduser username uml-net

###Logout and login again (to make the new group assignments work)

and with any luck Virtualbox is installed and running. You can then install a VM from the command line, start it up, and access the VM remotely. I did a clone of an existing VM and copied it over to the server, to save time and make life easier.

PART III
Installing a VM in a headless server on the command line

(Credits to Virtualbox help for some of this!)
We’ll use Windows XP as the example VM

On the headless server create the following directories:

sudo mkdir ~/.VirtualBox

(if not already there)

sudo mkdir ~/.VirtualBox/VDI

Then copy your WinXP.vdi file over

cp /path/to/your/vdi/WinXP.vdi ~/.Virtualbox/VDI

On the headless server/at the command line, create a new virtual machine:

VBoxManage createvm -name “Windows XP” -register

Create the settings (read the help file if you want alternatives)

VBoxManage modifyvm “Windows XP” -memory “256MB”-acpi on -boot1 dvd -nic1 nat

Use this as well if you are using host interface, you will need to replace “tap1” with the name of your interface!

VBoxManage modifyvm “Windows XP” -nic1 hostif
VBoxManage modifyvm “Windows XP” -hostifdev1 tap1

Add your VDI file as the first virtual hard disk of the new VM:

VBoxManage modifyvm “Windows XP” -hda “WinXP.vdi”

Start the virtual machine using VBoxVRDP:

VBoxVRDP -startvm “Windows XP”

If everything worked, you should see a copyright notice. If, instead, you are returned to the command line, then something went wrong.
On the client machine, fire up the RDP viewer and try to connect to the server. Assuming an Ubuntu client:

rdesktop -a 16 my.host.address

Advice is you should set your VM to run in 16m colours to match the rdesktop call – but this made XP look bad, so i left it alone.

Leave a Reply

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