VirtualBox Logo

In this how to I will go through creating a virtual machine, “a self-contained operating enviorment that behaves as if it is a separate computer”. This is really handy if you want to test out different Operating Systems, run Windows in Linux or generally muck about without messing with your actual system!

Installing VirtualBox

On Ubuntu Linux

  1. Open up a terminal and run:
     $ sudo apt-get install virtualbox-ose

    You'll be prompted for your sudo password.

  2. Install the appropriate module. Open up a terminal and run:
     $  uname -r
    2.6.24-16-generic

    You can see that your current kernel is 2.6.24-16-generic. I find its easier to open up Synaptic Package Manger here, search for virtualbox and then scan down for the virtualbox-ose module that matches the kernel. Be careful not to select the guest module. Mark it for installation and apply.

  3. Make sure you've added your regular user (or whichever users will be using VirtualBox) to the vboxusers group.
     $ sudo usermod -G vboxusers -a <username>

On openSUSE Linux

- VirtualBox can be installed using YaST (YaST –> Software –> Software Management and search for 'virtualbox') or through the command line:

 sudo zypper install virtualbox-ose virtualbox-ose-guest-tools virtualbox-ose-kmp-debug virtualbox-ose-kmp-pae xorg-x11-driver-virtualbox-ose

This will take some time. When the packages have installed, reboot your system. You will need to boot the new PAE kernel. This should now automatically be the default in your boot loader.

Create a Virtual Machine of Windows XP

On Ubuntu Linux

Create a Virtual Machine of Ubuntu 8.04 Server Edition

On Ubuntu Linux

From Scratch

  1. You'll need an iso image of Ubuntu 8.04. You can download it from the HEAnet repository.
  2. Run VirtualBox and select 'New'. Following the instructions, give your virtual machine a name and specify the OS type (in this case 'Linux 2.6')
  3. Allocate Base Memory. You'll need at least 256MB.
  4. Create a new virtual hard disk. A dynamically expanding image is best for general messing around. Give it a name and specify its size. 8GB will do.
  5. Continue following the instructions and finish.
  6. Now you have to mount the ubuntu iso image. Click on 'CD/DVD-ROM' and select the location of your iso image.
  7. Now hit start and you can install Ubuntu on the new Virtual Machine as you normally would on any physical machine. Once you've finished the install beware! We're not there yet!

Bugs

After installing Ubuntu server you will frustratingly not be able to boot it up, getting a error like

The kernel requeres the following features not present on the CPU: 0:6

There's a good explanation of the cause and fix here.

  1. Boot off the iso again. Select Rescue a broken system.
  2. Execute a shell and run the following:
     $ apt-get update;apt-get install linux-386;apt-get remove linux-server

    Now restart and voila!

Using An Existing Image

In order to save precious precious time, I've created a fresh image of Ubuntu 8.04 Server Edition.

  1. First download the Ubuntu 8.04 Server Edition for Ubuntu. Move it to ~/.VirtualBox
  2. Have a glance through the instructions in the from_scratch section. In part 4, instead of creating a new Virtual Hard Disk, you will use the existing one you just downloaded. Also there's no need to mount an iso.
  3. Hit finish. Now you should be able to start the virtual machine. Username is compsoc and password is letmein. Change as you see fit!

On openSUSE Linux

- Preparatory work. VirtualBox may throw an error because of permissions when you try to launch the virtual machine. You will need to add yourself to the vboxusers group. To do this, open Konsole (the KDE terminal). It is located under Applications –> System –> Terminal –> Terminal. Execute this command as the root user:

 sudo groupmod --add-user <your_username> vboxusers

(where <your_username> is the name of your account under /home, such as 'bob'). You will need to log out and log back in again for this change to come into effect.

- Now, open VirtualBox. In the Kicker panel, click on the Gecko icon, change to the Applications tab, click on System and launch VirtualBox OSE.

- Click on New to create a new virtual machine. Follow the instructions as per installing VirtualBox on Ubuntu Linux. You may use the CompSoc virtual hard drive image (vdi) file. This negates the need to create a virtual hard disk and install Linux on it. The username for this image is compsoc and the password is letmein. This can be easily changed but is fine for casual use. You will need to add this drive by clicking on Existing and locating the hard disk image instead of creating a new (virtual one).

- If, upon launching your virtual machine, you get the error message about not having the VirtualBox kernel module installed, revert to your terminal and execute this command to load it:

 sudo /etc/init.d/vboxdrv setup

- To ensure this module is loaded every time you boot your machine, open YaST and enter your password. Click on System and launch the /etc/sysconfig Editor. Expand the System section, then Kernel. Click on MODULES_LOADED_ON_BOOT and enter vboxdrv in the text field. Click Finish to apply your changes.

- Launching the virtual machine should now work. Be sure to select the correct keyboard layout. If you experience errors booting from the ISO or VDI files, tap F6 and delete the words 'quiet splash' for verbose details during boot-up to get an idea of what is going wrong.

- If you're using the Ubuntu CD or ISO, proceed with installation. You will need (at minimum) at swap partition (~512 MB) and a root partition (/).

On Windows XP

- Download the Windows version of VirtualBox and install it.

- You can, as above, create your own VDI file or use the existing one with the username of compsoc and password letmein. The steps involved, in both cases, are the same as for using VirtualBox under Linux (above).

 
how_to/virtualbox.txt · Last modified: 2008/11/17 15:25 by andrewjregan
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki