Install VirtualBox OSE

Install either VirtualBox or VirtualBox Open Source Edition - DO NOT install both!

Installation

Install and configure VirtualBox

sudo apt-get install virtualbox-ose virtualbox-ose-modules-`uname -r`
sudo gpasswd -a `whoami` vboxusers

You will now have to log out of your desktop session and log back in order to update your group membership.

If you have a multi-core CPU and experience high CPU usage even when the guest OS is almost no using CPU, you can force Virtual Box to execute in just one of your cores by launching it through taskset.

sudo apt-get install util-linux
taskset -c 1 virtualbox

Modification necessary after installing a new kernel

If the sources are not installed yet:

sudo aptitude install virtualbox-ose-source module-assistant

And after that:

sudo m-a prepare
sudo m-a a-i virtualbox-ose

Configuration of Client

After install the client operating system, you need to install the guest additions. For an Ubuntu 8.04 client, do the following within the running vm:

sudo apt-get install virtualbox-ose-guest-modules-generic

Mount the iso for the guest additions CD (menu Devices/Install Guest Addtions…), then install the guest additions as su. After installation, restart the virtual machine.

Now you need to manually adjust the xorg configuration to enable the VB driver and desired screen resolution:

vim /etc/X11/xorg.conf

Replace:

Section "Device"
  Identifier "Configured Video Device"
EndSection

with:

Section "Device"
  Identifier "Configured Video Device"
  Driver "vboxvideo"
EndSection

Changing screen resolutions in Ubuntu 8.04 is done with RandR, which is not supported by VirtualBox. Replace:

Section "Screen"
  Identifier "Default Screen"
  Monitor "Configured Monitor"
  Device "Configured Video Device"
EndSection

With:

Section "Screen"
  Identifier "Default Screen"
  Device "VirtualBox graphics card"
  Monitor "Generic Monitor"
  DefaultDepth 24
  SubSection "Display"
    Depth 24
    Modes "1024x768"
  EndSubSection
EndSection

Dedicated ethernet interface for the VirtualBox client

sudo apt-get install bridge-utils
sudo vim /etc/network/interfaces
# The primare network interface (for the host)
auto eth0
iface eth0 inet dhcp
# The secondary network interface (for the client only)
auto eth1
iface eth1 inet manual
# The network bridge from the vm to the physical nic
auto br0
iface br0 inet manual
bridge_ports eth0 vbox0
sudo /etc/init.d/networking restart
sudo vim /etc/vbox/interfaces
vbox0 `whoami` br0
sudo VBoxAddIF vbox0 `whoami` br0

A thorough guide is available at https://help.ubuntu.com/community/VirtualBox#Networking

Setting up the client as a server

Running the client, modify /etc/network/interfaces to obtain an IP address by dhcp or using a static address. If the IP address is static, modify /etc/resolv.conf with the nameservers, so you can access the internet.

Install Guest Additions

Start up your Ubuntu guest. In VirtualBox, click Devices→Install Guest Additions and the guest OS should recognize a new CD. Open a terminal and run this command:

sudo /media/cdrom/VBoxLinuxAdditions.run

The installer should work for a minute, and then prompt you to restart the virtual machine.

Ubuntu 8.04

Older versions of VirtualBox had trouble, but VirtualBox 2 has fixed the setup issues with Ubuntu 8.04 guests. The screen resolution will be adjusted on-the-fly as you resize the VirtualBox window. Mouse pointer integration will be on by default. You’re done!

Ubuntu 8.10

Mouse pointer integration works, but both pointers are still drawn on the screen. The larger problem is that the new display driver does not work. For some reason Ubuntu isn’t using it. Turn it on manually in your xorg.conf file.

Open xorg.conf:

sudo gedit /etc/X11/xorg.conf

Find the device section, which should look like this:

Section "Device"
  Identifier  "Configured Video Device"
EndSection

And add the driver line like this:

Section "Device"
  Identifier  "Configured Video Device"
  Driver  "vboxvideo"
EndSection

Log out for the change to take effect. Auto-resizing should work perfectly now, and the mouse cursor issue is also fixed. However, there seems to be a bug where the bottom GNOME panel moves to the top when the screen is resized.

Autostart a virtual machine

Put an autostart script into /etc/init.d, for example vmachine.sh for vm 'Vmachine':

#! /bin/sh
VBoxManage vmstart Vmachine

Then run the following command to setup the autostart in the different runlevels:

update-rc.d vmachine.sh defaults

You can check existing entries with the following command:

ls -l /etc/rc?.d/*vmachine.sh