Install VirtualBox 3.0

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

Installation

Add the repository to your /etc/apt/sources.list:

deb http://download.virtualbox.org/virtualbox/debian hardy non-free

Add the Sun public key for apt-secure:

wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | sudo apt-key add -

Install VirtualBox:

apt-get install virtualbox-3.0

Ensure that the VirtualBox host kernel modules (vboxdrv, vboxnetflt and vboxnetadp) are properly updated if the linux kernel version changes:

apt-get install dkms

If the kernel modules are not updated automatically, run the following:

sudo /etc/init.d/vboxdrv setup

If you replace OSE with 3.0, you may need to remove the old modules manually

sudo apt-get remove virtualbox-ose-modules

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

Configuration of Client

After install the client operating system, you need to install the guest additions. They are accessible through the menu item “Devices” in the Vbox Window.

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

Enter the following at Command: by accessing menu System/Preferences/Sessions/Startup Programs:

VBoxManage startvm <VM name>

Access shared folders from a Linux client

mount -t vboxsf <share_name> <mount_point>