Step 1 – Prepare Your System
In this tutorial we’re going to virtualize Ubuntu 8.04.1 on Windows XP Professional SP3 x86 using Sun xVM VirtualBox 2.0.2. To prepare for this tutorial you should download the necessary resources:
- Ubuntu 8.04.1 Desktop CD (available here)
- Sun xVM VirtualBox 2.0.2 (available here – choose the package appropriate for your platform)
This tutorial was tested on an Acer TravelMate 5620 running Windows XP Professional SP3 x86. This tutorial will work equally well on Windows XP Home Edition and also on either the 32-bit or 64-bit editions of either builds (subject to hardware requirements – read below).
Before going down the virtualization path you should make sure that the system which will act as the host has sufficient resources to run both its own operating system as well as all the virtual machines you’re planning to run.
Running virtualized desktop operating systems isn’t particularly processor intensive so really any relatively up-to-date CPU should be able to handle it. Obviously processors with more than one processing core is beneficial as are CPUs which support Intel-VT or AMD-V.
RAM and disk performance and availability are the most essential components. You really want to be able to run both the host and guest OSes within physical memory. As soon as physical RAM is full and spills over to the page file hard drive performance will decrease dramatically adversely affecting both systems. Therefore on a system running Windows XP as the host you really need at least 1GB RAM to make virtualization worthwhile. Obviously the more RAM the better but if you’ve got 4GB available then you will really need to install a 64-bit version of XP to get the most out of it.
Hard drive performance is also a major factor as the virtual guest will be completely dependent on it. You shouldn’t attempt to host the virtual hard drive of the guest system on a hard drive slower than 7200rpm so laptop users should verify their hardware first. You can use an external USB 2.0 or Firewire hard drive but certain intensive disk operations like creating the virtual disk formatting it or copying large amounts of files around will chew up the available bus bandwidth and performance will be affected. Finally if you host the entire virtual guest on the primary partition of the host fragmentation will occur and affect both systems. So keep the partition defragged and reap the performance benefits.
The last word of warning is that it’s important to remember that your system will be running two operating systems so resource management becomes very important. For example it’s not a good idea to encode video while running a live VM unless you have some serious processing power to hand. It’s worthwhile to fire up the Performance monitor in Windows XP to see under what sort of loads your system is running. To access the Performance monitor right-click the Start Bar select Task Manager and go the Performance tab. You want to keep your eye on the “CPU Usage” and “Memory” graphs.
Step 2 – Install VirtualBox
While either of these options is more than acceptable we chose VirtualBox because we wanted to base the tutorial on a platform which was free intuitive and which supported as wide a range of host and guest operating systems as possible. Virtual PC 2007 SP1 is excellent and freely available but does not support non-Windows systems very well or 24-bitcolour depth while VMWare Workstation is an outstanding platform but is proprietary.
During testing we were very impressed with VirtualBox and are using it as the platform for all our virtualization tutorials.
To install VirtualBox:
- Launch the installer and click Next
- Accept the license agreement
- in the Custom Setup window make sure that all the options are selected then select Next
- Click Install
- During the install you will be prompted to approve the installation of virtual device drivers as they’re not signed. Accept the installation
Once installed launch VirtualBox from the Start Menu. You’ll be prompted to register (which is free) and this also creates the default VirtualBox folder structure within your profile (%USERPROFILE%.VirtualBox).
[#PAGE-BREAK#Create New Ubuntu VM#]
Step 3 – Create New Ubuntu VM
Click the New icon to start the New Virtual Machine Wizard
- Click Next
- Type in “Ubuntu” as the name and select “Ubuntu” from the “OS Type” dropdown menu. Click Next
- Assign as much memory as you like beyond the base memory recommendation. In this case 256MB is the recommended amount. Click Next
- On the “Virtual Hard Disk” screen click “New” to launch the Create New Virtual Disk Wizard and click Next.
- hoose whichever disk type you prefer. The advantage of a fixed-size image is that as all the space is reserved up front there’s an ongoing disk performance benefit as the image doesn’t need to keep expanding as you use it. The downside is that all the space is used at once and it takes longer to create. Click Next
- Name the image file accordingly and assign some space (at least 8GB for the Ubuntu boot disk). Click Next and then Finish. The newly-created Ubuntu.vdi is now populated. Click Next and then Finish and the VM is created
Step 4 – Install Ubuntu
Download the latest version of Ubuntu – at the time of writing the version was 8.04.1 (Hardy Heron). You just need the normal 32-bit desktop ISO (ubuntu-8.04.1-desktop-i386.iso).
There are a couple of methods available to install the OS. You can burn the ISO to CD and connect the physical optical drive to the virtual guest or you can attach the ISO directly. Actually a third option is to install a virtual image utility like Daemon Tools or Slysoft Virtual CloneDrive mount the ISO in the host virtual drive and attach the drive letter to the virtual guest.
Installing from the ISO is quicker than from CD but it does result in more intense hard drive activity.
To mount the ISO highlight the Ubuntu VM and in the right-hand side of the screen click “CD/DVD-ROM” then tick “Mount CD/DVD Drive” and then “ISO Image”. There are no images available for selection in the dropdown menu so click the folder icon. This opens the Virtual Disk Manager – VirtualBox cleverly keeps track of all the ISOs you access regardless of where they’re kept and catalogues them making it much easier to access them later.
Click Add and browse for the Ubuntu ISO then click Select and then OK. The ISO is now attached to the VM as the primary optical drive.
Highlight the Ubuntu VM and select Start. This starts the VM connects you to the machine and as there is no OS present on the virtual disk boots from the mounted ISO.
You will get a warning about the “Auto capture keyboard” setting – this causes the VM to capture keyboard input for its own use but you can click the host key to release the capture. By default the host is the Right Ctrl key. There is a similar feature which captures the mouse input and again pressing the host key will release the cursor back to the host. This behaviour is common across all virtualization platforms when the guest OS in a state where host integration tools have not been installed or loaded – we’ll install these tools post-install.
You will also get a warning message that the VM is optimised for 32-bit colour but that you’re currently running in 16-bit (which the Ubuntu CD does do). Just ignore this message.
Select your installation language using the keyboard (the default is English). If you want to boot into the Live CD environment choose the top option “Try Ubuntu without any change to your computer”. You can start the installation from within the Live CD GNOME interface. To install Ubuntu straight away select “Install Ubuntu”. You don’t need to select any of the various boot options available.
- on the Welcome screen select the Language and click Forward
- on the “Where are you?” screen select your locale and click Forward
- select the appropriate Keyboard layout and click Forward
- on the “Prepare disk space” screen select “Guided – use entire disk” and click Forward
- on the “Who are you?” screen type in your username and password details and click Forward
Most virtualization solutions offer a software package which can be installed on guest machines which provides better access to the host hardware and other resources like shared folders clipboard file copying and so on.
Once the Ubuntu VM has been installed and has rebooted log in to GNOME. Then press the host key to release the cursor then select the Devices menu and then “Install Guest Additions”. This mounts the additions image into the VM.
Click back into Ubuntu and open a terminal – Applications Accessories Terminal. Type in the following command:
“sudo /media/cdrom/VBoxLinuxAdditions-x86.run” and press Enter (assuming you’ve installed a 32-bit Ubuntu system). This will start the Guest Additions installation script.
Once complete reboot the system for the additions to take effect. The shortcut to reboot from the terminal is:
“sudo shutdown -r 0“
Once the system restarts there will be some obvious improvements – the keyboard and mouse cursor input are automatically captured and released without having to use the host key and there’s an overall improvement in performance.
[#PAGE-BREAK#More VirtualBox Options#]
Step 5 – More VirtualBox Options
By default and presumably to maximise compatibility during installation there are a number of guest options which are disabled but which you’ll probably find it useful to enable once the system is operational. To access these options highlight the VM in VirtualBox and then click on “General” in the right-hand window.
Under General there are two particular tabs of interest – Basic and Advanced. Under Basic you can adjust both the system and graphics memory. The graphics memory is expandable up to the available system graphics memory – on Windows Vista you don’t want to take too much away from the host or system performance will suffer.
Under Advanced you can add or remove options from the boot order and adjust the order itself. You can also enable support for CPU virtualization which will improve system performance.
You can also enable Audio support add more network adaptors connect to the host system’s serial and USB ports share folder between the host filesystem and the guest and enable remote desktop access to the guest via VirtualBox’s RDP server.
If you’re familiar with other virtualization packages then VirtualBox will be very intuitive. If not spent some time playing with the other options such as system snapshots to save a virtual guest at a point in time (very useful for writing tutorials!) moving into and out of fullscreen by using the host+F key combo.
Also check out our other tutorials for virtualizing on different platforms.