Monday, 30 June 2008

Setting up Ubuntu on VirtualBox Windows XP Host

screenshot of ubuntu inside xp
The geeky side of me got the better of myself this weekend and I thought I'd try out Ubuntu using VirtualBox. And I have to be honest, it was a pretty painless experience and now I have ubuntu running inside xp on my laptop!

Ubuntu is a great operating system in it's own right, but if you are new to unix, but want to try it out, it is definitely for you! Also with VirtualBox it's a no risk way of setting it up on Windows.

VirtualBox from Sun is a machine emulation thing like vmware or Microsoft's VirtualPC. Basically it lets you run a virtual(emulated) pc as an application on your desktop. It's free and has a pretty small memory footprint and I found it a lot easier to use than vmware which I am sick of using at work.

Here are the instructions I followed. I installed Ubuntu 8.04(Hardy Heron) , but these instructions should work for older versions too.


I followed the steps on the website below to install virtualbox and ubuntu.

Install Linux guest additions:

You need to do this to get ubuntu in fullscreen mode and (i.e. a better screen resolution thatn 640x480). This is from the VirtualBox's help.

4.3.1. Installing the Linux Guest Additions

The VirtualBox Guest Additions for Linux are provided on the same ISO CD-ROM as the Additions for Windows described above. They also come with an installation program guiding you through the setup process, although, due to the significant differences between Linux distributions, installation may be slightly more complex.

Installation involves the following steps:

Before installing the Guest Additions, you will have to prepare your guest system for building external kernel modules. This is exactly the same process as described in Section 2.3.2, “The VirtualBox kernel module”, except that this step must now be performed in your Linux guest instead of on a Linux host system, as described there.

Mount the VBoxGuestAdditions.iso file as your Linux guest's virtual CD-ROM drive, exactly the same way as described for a Windows guest in Section, “Mounting the Additions ISO file”.

Change to the directory where your CD-ROM drive is mounted and execute as root:

sh ./

The VirtualBox Guest Additions contain several different drivers. If for any reason you do not wish to install them all, you can specify the ones which you wish on the command line - for example

sh ./ x11
to install the X Window graphic drivers. Type in the command

sh ./ help

Setup Shared folders:

Shared folders let you share any folder on your host pc (im my case my xp laptop) and your guest machine (in my case ubuntu)

With VirtualBox I shared the "My Documents" folder on my host machine so then I could execute the command below in ubuntu to see this folder :

sudo mount -t vboxsf "My Documents" /home/sm/Documents/host_docs

Setting up Internet connectivity in ubuntu:

This is probably the trickiest step, but if you follow what it says on this link you should be fine.

Other random things

  • I gave the ubuntu guest 256MB of memory and it was fine.
  • I installed the virtualdisk , on my portable usb harddrive and everything worked fine, even though I was afraid it might be a bit slow.
  • If you want to listen to mp3s and watch movie files and things, ubuntu needs to download a whole load of codecs, so make sure your intetnet connection is working before you do this.
  • I haven't tried out the usb support, but I think I read somewhere that your usb device will only be accessible from your host or guest, not both at the same time.
  • In VirtualBox before running your Ubuntu guest, remember to set the Audio to your soundcard so you can get sound in ubuntu
  • Ubuntu takes is a 700mb download, so set the download off now before your do anything else
  • Make sure you install the linux additions, so you get a proper fullscreen , VirtualBox's seamless mouse integration(you will know what this is when it works) and copying/pasting works between the guest and host machines.
  • Check out the Top 10 Ubuntu apps and tweaks from Lifehacker, for a few things you can install.
  • If you are new to unix, look at Learn Unix in 10 minutes to familiarize yourself with some commands.
If you get stuck , please post a comment, the chances are I may have run into the same problem. Also if you discover anything useful please let me know.


  1. can i use my main hard drive as a shared folder?

  2. Thank you for the example! I read walkthroughs all over the place, and never realized that I had to name the share in linux the same name that was given in VBox! (For example, if you name the share "Thing1" in VBox then you need to type -t vboxsf Thing1 mount_point

  3. This comment has been removed by a blog administrator.

  4. I could use a little help getting my guest ubuntu 8.04 to see virtualbox soundcard - in vbox settings audio i have selected windows direct sound and have selected sound blaster 16 for the card - however booting up ubuntu it shows no soundcard installed/recognised and in sound setting i choose also within ubuntu.

  5. i solved my own problem cheers, it seems that using vbox sound setting of windows directsound and soundcard sb16 should be for guest OS of DOS win 9x so i just used the other sound card and fixed. sound in ubuntu.