Step 1 – Prepare Your System
In this tutorial we’re going to virtualize Windows XP Professional SP3 on Ubuntu 8.04.1 x86 using Sun xVM VirtualBox 2.0.2.
Before starting the tutorial you’ll need to download the VirtualBox Debian installer for Ubuntu 8.04 (available here).
You’ll need a system already running Ubuntu 8.04.1. You will also need the XP installation CD to hand.
This tutorial was tested on an Acer Extensa 5620 running Ubuntu 8.04.1.
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 Vista as the host you really need at least 2GB 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 operating system to get the most out of it.
For this reason Ubuntu makes a very good virtualization host as the amount of memory it needs to run effectively is quite low leaving more resources available for the VMs.
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 System Monitor in GNOME to see under what sort of load your system is running. To access the System Monitor go to System Administration System Monitor and then the Resources tab. You want to keep your eye on the CPU and Memory graphs.
Step 2 – Install VirtualBox
Before we start a quick note about our choice of virtualization platforms. There are other options available for Ubuntu (and other Linux platforms) such as Xen.
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. It’s also very easy to set up on Ubuntu and does not require advanced Linux technical skills.
During testing we were very impressed with VirtualBox and are using it as the platform for all our virtualization tutorials.
To install VirtualBox you will need an active internet connection:
- Right-click the Debian installer and select “Open with “GDebi Package Installer”"
- The package installer loads. Click “Install Package” and enter your user password when prompted
- Package files are installed and extra modules are downloaded
Once installed launch VirtualBox from Applications –> System Tools –> Sun xVM VirtualBox. You’ll be prompted to register (which is free) and this also creates the default VirtualBox folder structure within your user profile (/home/username/.VirtualBox/).
[#PAGE-BREAK#Create New XP VM#]
Step 3 – Create New XP VM
Click the New icon to start the New Virtual Machine Wizard
- Click Next
- Type in “Windows XP” as the name and select “Windows XP” from the “OS Type” dropdown menu. Click Next
- Assign as much memory as you like beyond the base memory recommendation. In this case 192MB 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.
- Choose 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 10GB for the XP boot disk). Click Next and then Finish. The newly-created Windows-XP.vdi is now populated. Click Next and then Finish and the VM is created
[#PAGE-BREAK#Install Windows XP#]
Step 4 – Install Windows XP
There are a couple of methods available to install the OS. If you have the physical media you can insert that into the host and attach the host’s optical drive to the VM. Alternatively if you have the media as an ISO you can attach that directly to the VM as the VM’s optical drive.
Installing from the ISO is quicker than from CD but it does result in more intense hard drive activity.
If you have the physical media and want to create an ISO (which is useful as it reduces wear and tear on the media) you can do this on Ubuntu using Brasero Disc Burning (Applications –> Sound & Video –> Brasero Disc Burning). Select to copy a CD/DVD and change the destination from physical media to file output. You can change the target file properties (location and name) but by default Brasero will create an ISO file in /home/username/
To mount the ISO highlight the Windows XP VM in VirtualBox 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 Windows XP ISO then click Select and then OK. The ISO is now attached to the VM as the primary optical drive.
Highlight the Windows XP VM and click Start. With no operating system present and the installation media attached the VM will automatically boot into the Windows XP setup procedure.
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.
On the “Welcome to Setup” screen press Enter then press F8 on the Licensing Agreement page.
Select “Unpartitioned space” on the available disk and press Enter to install then on the next page choose the top option – “Format the partition using the NTFS file system (quick)” and press Enter.
Windows XP will now format the partition and copy the setup files across. You won’t be prompted for input until the system restarts and boots into the graphical mode setup.
When the graphical setup loads the first screen is the Regional aned Language Options window. Choose your preferences and click Next.
Type in your name and organisation (if necessary) and click Next.
Type in the product key and click Next.
Type in the computer name you want to assign to the VM system and a password for the built-in Administrator account then click Next.
Choose the appropriate time and date options for your locale and click Next.
Setup will continue and then install the networking components. make any changes if you need to and click Next. Type in workgroup or domain credentials if needs be and click Next.
That’s all the user input required – Windows XP will now complete the installation and the system will reboot.
[#PAGE-BREAK#Install Guest Additions#]
Step 5 – Install Guest Additions
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 Windows XP VM has been installed and has rebooted skip through the welcome animation the internet connectivity test type in username and log into the desktop. 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.
The additions media will autorun and launch the setup procedure. Click Next the accept the License Agreement and click Next again. Accept the default install location and click Install.
Setup will continue and the package will install a number of drivers which offer better integration with the host’s resources and improved guest performance. These drivers are not signed by Microsoft so you’ll get a warning popup message during installation. Click “Continue Anyway” on all the popups then reboot to complete the install.
When the system restarts you’ll be able to move the cursor between guest and host without having to use the host key and there will be an icon in the system tray indicating that the additions are active. Installing the additions also gives you extra functionality between guest and host which we’ll look at in the next step.
[#PAGE-BREAK#More VirtualBox Options#]
Step 6 – 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.