HOW TO: Virtualise Ubuntu on Vista


Scenario

You want to create a virtual machine using Microsoft Virtual PC 2007 and install Ubuntu 6.10 as the guest operating system.

Tutorial Summary

In this tutorial we’re going to create a Virtual PC 2007-based virtual machine and install Ubuntu 6.10 as that machine’s operating system. While Virtual PC will accept Linux as the guest OS it’s not designed to support it natively so we need to make some modifications to Ubuntu to get it working.

This has been tested using Virtual PC 2007 on two machines one running Windows XP SP2 and one running Windows Vista Ultimate.

What you need

Windows Vista

Ubuntu 6.10 Alternate Install Image (free)

Microsoft Virtual PC 2007 (free)

Get Started

We’ll assume that you’ve already downloaded and installed Virtual PC 2007. If not you can download it from here.

The first step is to download the correct Ubuntu install image. In this scenario we can’t use the normal image (ubuntu-6.10-desktop-i386.iso) for one simple but important reason: the Virtual PC 2007 graphics adaptor only supports 16-bit colour depth for its virtual machines and the Ubuntu Live CD as well as the operating system itself defaults to 24-bit. There’s no denying that Ubuntu looks great but as a virtual machine it renders as a garbled mess.

So to get Ubuntu working in Virtual PC 2007 we need to use a text-based installation which doesn’t use the xserver. The install image you need is the alternate install image – ubuntu-6.10-alternate-i386.iso. It’s just as big as the normal desktop image (713MB) so the download could take a while.

Next create a new virtual machine from the Virtual PC Console.

Virtual PC 2007 – New Machine

Virtual PC 2007 – Create Machine

Name the machine appropriately (eg: “Ubuntu”).

Virtual PC 2007 – Name Machine

When prompted for the operating system select “Other” from the drop-down list.

Virtual PC 2007 – Choose OS

The default amount of RAM assigned to the machine is 128MB. You’ll really need at least 256MB and 512MB is better still.

Virtual PC 2007 – Choose RAM

Create a new virtual hard disk and make it around 10GB in size. Ubuntu doesn’t need this much but it’s handy for installing updates and future applications (ignore the amount in the screenshot!)

Virtual PC 2007 – Virtual Disk

Finally highlight the virtual machine in the Console and select Settings. Modify any features you need to – I prefer to change the networking adaptor to NAT and disable both the floppy drive and sound adaptor.

Virtual PC 2007 – Settings

Install Ubuntu

Start the newly-created virtual machine. Before it boots too far click on the CD menu and select which physical drive you want to use or choose “Capture ISO image” and navigate to the alternate Ubuntu image. You can also pause the machine by pressing RIGHT_ALT+P. Pressing the same keys again resumes the machine.

Virtual PC 2007 – Install Ubuntu

When the boot menu loads press F4 for VGA options. Choose a resolution that’s going to work well on your display but make sure it’s at 16-bit colour depth (eg: 800 x 600 x 16). Then select “Install in text mode” and press Enter.

Virtual PC 2007 – F4 Options

Choose the installation language then press Enter then choose the location and press Enter.

Install Ubuntu – Choose Language

Install Ubuntu – Choose Location

When prompted to auto-detect the keyboard layout select No and press Enter.

Install Ubuntu – Keyboard Layout

Then choose U.S. English as the type (or origin) of the keyboard and press Enter again and U.S. English again at the next screen and Enter yet again.

Install Ubuntu – Keyboard Origin

Install Ubuntu – Keyboard Layout 2

Ubuntu then goes through the hardware detection phase and starts loading hardware-specific components.

When prompted to change the hostname it’s a good idea to make it something other than “ubuntu”. Change the name and press Enter.

Install Ubuntu – Hostname

When choosing where and how to install Ubuntu select “Erase entire hard disk”. Ubuntu will automatically suggest a partitioning scheme and when you’re prompted to write the changes to disk select Yes.

Install Ubuntu – Partitition Disks

Install Ubuntu – Partition Disks 2

Choose your capital city for the correct timezone settings.

Install Ubuntu – Time Zone

When configuring the clock select No to UTC and press Enter.

Install Ubuntu – Clock UTC

Next type in the full name of the user to be created and hit Enter.

Install Ubuntu – Username

Then either accept the default account username Ubuntu chooses or type one in of your own (must be lowercase) and press Enter. Then type in a password and press Enter verify the password and Enter again.

Install Ubuntu – Username 2

Ubuntu then starts the main installation of the base system and then the main suite of software and applications.

Install Ubuntu – Installing

When prompted to configure the xserver the acceptable resolutions should already be highlighted – 640×480 800×600 and 1024×768. Press Enter to accept the defaults and the installation continues. This bit takes the longest so it’s probably cup of coffee time.

Install Ubuntu – Resolutions

Configuring Ubuntu

When the installation is finished click on the CD menu and release the physical drive or ISO and press Enter to restart.

Install Ubuntu – Reboot

If you let Ubuntu load as normal you’ll get a scrambled screen as it attempts to render at 24-bit colour depth. To fix this hit ESC when the GRUB boot loader starts up to access the GRUB boot menu and select to boot into recovery mode.

Install Ubuntu – Recovery Mode

This loads Ubuntu but doesn’t launch the xserver so you’re safely in command line mode. Now we can manually edit the xserver configuration to reduce the colour depth.

First make a backup of the configuration. From the command line type in:

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup

Install Ubuntu – Backup xorg.conf

This creates a copy of the configuration file xorg.conf called xorg.conf.backup which you can use to restore the configuration if things go wrong. Remember that Linux is case-sensitive do make sure to type in X11 and not x11.

Then type in:

sudo nano /etc/X11/xorg.conf

Install Ubuntu – Edit xorg.conf

This opens the xorg.conf file in GNU Nano – a text editor. Press CTRL+W to launch Where Is and type in “DefaultDepth”. Nano then scrolls along to the DefaultDepth line entry which is currently set to 24. Use the arrow keys to move the cursor over and then delete the entry. Then type in 16.

Install Ubuntu – DefaultDepth

Press CTRL+O to save the changes and Enter to overwrite the existing file then CTRL+X to exit.

Install Ubuntu – Save Changes

Then type in reboot and Ubuntu restarts.

Install Ubuntu – Reboot

When the virtual machine loads up allow Ubuntu to start normally and it will load correctly using 16-bit colour.

Install Ubuntu – Install Completed