Installing Virtual Ubuntu on Windows

30 November -0001
Justin Klein Keane
June 19, 2007

Running Ubuntu Linux on your Windows XP machine is probably a lot easier than you would suspect. Using virtualization you can run almost any operating system on top of your 'host' operating system these days. Using this technique you can try out new distributions of Linux, other operating systems, set up test machines and experiment with networking and servers. Finding the right free open source software (FOSS) and tools to accomplish this task can be a little daunting though - especially if you're using Windows as your host operating system.

Before I begin I should point out that one could mimic this process on almost any operating system. The tools I utilized are supported across a number of platforms.

The primary tools used to accomplish the virtualization I will describe are VMware Player and VMmanager. VMware Player is a virtualization tool that is used to run the actual guest (virtualized) operating system. However, VMware Player does not include all the tools needed to install a new virtual environment.

Getting Ready for Install

Before beginning it is wise to create a directory somewhere on your machine to store your configuration files and your virtual image. This image may take up several gigs so be sure to choose a directory location on a drive big enough. Try staring with virtual images of 2-4 GB.

Before you begin the install you'll want to download the .iso of the guest operating system. For Ubuntu it is best to use the 'alternative' installation. Download the latest version (currently Ubuntu 7.04) and store it in the directory you have created for your virtual machine.

Setting up the Virtual Drive

In order for VMware Player to work you have to have a drive image that it can use to simulate a machine. Setting up an image can be done using a number of tools but I find that VMmanager is the simplest and most reliable.

VMmanager runing

Using VMmanager you partition off a piece of your hard drive to use for the virtual image, format it, and use a GUI to construct the various configuration files needed by VMware Player. The first thing you'll need to do is download and install VMmanager. You may receive warnings during the installation that the software hasn't been certified by Windows but you can safely ignore these.

Starting up VMmanager presents the users with two straightforward options: 'Create a new virtual machine' and 'Modify an existing virtual machine'. Select the first option to get started. This will open up a new window with tabs to specify the configuration and format of your new image.

For our Ubuntu virtual machine start with the 'Project' tab. Select 'Linux' for the Operating System, 'VMware Workstation 5.x' for the Compatibility and select 'Ubuntu Linux' from the drop down menu.

Next select the 'RAM' tab. VMmanager defaults to a paltry 128 MB of RAM. You probably want to increase this depending on the amount of actual RAM on your system. 384 or 512 is probably enough. If you have multiple CPU's in your machine you can also select which one to use for the virtual machine.

In the 'Hard Disk' tab you can probably select the defaults. You may want to increase the drive size above the default of 2048 however. Perhaps double that number (around 4 GB) will be sufficient to get started. Be sure not to choose too little storage though or you'll have trouble installing packages on your Ubuntu virtual machine.

On the 'Drives' tab you want to make sure to change the drop down menu for the 'CD-ROM' that defaults to 'auto detect'. Choose 'use ISO image' and then browse to the installer iso that you downloaded (in our case ubuntu-7.04-alternate-i386.iso. This will allow the virtual system to mount the ISO as if it were a disk in the drive and allow you to complete the install.

For the 'Ethernet' tab you have two options that will work for your ethernet connection. You want to be sure to enable your connection so you can download updates and utilize networking. The 'NAT' mode creates a sort of network address translation behind your existing connection. This means that your physical ethernet card receives information for both the host and the virtual machine. The virtual machine is assigned a reserved IP address (such as 192.168.174.128) and your host machine masks this IP address and manages traffic to and from the virtual machine (just as a regular NAT device). This means that the virtual machine will be invisible to the outside world but will be available to the host operating system.

The other option for the 'Ethernet' tab is to choose a 'Bridged' connection. Doing this will mean that the virtual machine will be assigned an available IP address (from DHCP for instance) and your virtual machine will be exposed to the outside world on it's own IP address. Your physical ethernet card will act as a host to multiple IP addresses, segmenting traffic as needed. This can be extremely useful if you want to set up a virtual machine that will serve other hosts.

The 'MAC Address' portion of the 'Ethernet' tab is interesting to note. You can select the default 'Don't change' or you can create spoofed MAC addresses for the bridged connections. This will mean that traffic analysis won't easily be able to tell that the virtual machine is in fact hosted on the same hardware as a real machine.

For the 'Adapters' tab it is probably safe to choose the defaults and not enable any adapters. You can go back and alter your configuration at a later time, but for the install process you want to cut down on as many X factors as possible.

Next click the 'Finish' tab and you'll see the 'OK' button. Clicking this button will write the configuration files, partition off drive space and create your image. Go ahead and do that and watch the messages that will display for any errors. This process may take a couple of minutes and will hog up a lot of your computers CPU and memory so try to limit other applications running when you're doing this.

Once VMmanager is finished creating the image file you can close the program. We're now ready to begin the installation process.

Installing Ubuntu

Once you have an image installing should be fairly straightforward. Start up VMware Player.

VMware Player

You'll see to prominent options: 'Open' and 'Download'. You can download pre-built images but we're going to open the one we just created. Click 'Open' and browse to the folder where you created your image with VMmanager. There should be only one .vmx file in that directory so select that one (it is likely named 'Ubuntu Linux.vmx').

Note that when your mouse is inside VMware Player you have to press the control (Ctrl) and alt keys together to break your cursor out of VMware Player.

As soon as you open that image the installation process should start. This will proceed exactly as a normal installation. You can safely choose the defaults and sit back and watch the install process chug away. You can safely format the entire available hard drive since VMware Player can only see the space set aside in the image rather than your actual hard disk.

The installation process can be a bit tricky and error prone. I didn't have any luck with the regular install ISO which is why I recommend the alternate. The alternate installer is text based, so it's not as pretty but it works just fine.

Installing Ubuntu 7.04 alternate

If you have trouble try recreating the image space with other options or change your options in the install process. In most cases, however, you shouldn't run into any issues.

Once Ubuntu is finished installing it will 'reboot' the virtual machine and you should be able to log in normally, install updates, and use the OS as normal.

Installing Ubuntu updates

At any time you can close VMware Player by 'shutting down' Ubuntu. You can also simply close VMware Player and it will save the state of your virtual machine and exit. This is quite handy because you don't have to 'reboot' the next time you start the virtual machine. Simply start VMware Player and open the image file and the virtual machine will open back up just the way it was (much the same way a laptop hibernates).

Ubuntu up and runing

If at this point you want to enable further hardware support for your Ubuntu installation simply open VMmanager and alter the configuration files you created. You may want to switch the CD-ROM to the actual CD drive rather than the ISO image since it's no longer necessary. You may also want to enable USB support so you can use external devices or even sound. Be sure to back up your original configuration file though so you can 'fix' any mistakes you might make.

Final Thoughts

Using a virtual machine based on an image has several interesting applications beyond just experimentation. Since the virtual machine is actually run from a 'hard drive' that is nothing more than a file it is possible to perform several interesting operations on that file.

One option is to place the image, log files, and other configuration files on a USB drive or other removable media. This allows you to carry your virtual machine with you and use it anywhere VMware Player is installed.

Another interesting possibility would be to place the virtual machine on an encrypted volume. This could easily be done using TrueCrypt or many other encryption utilities. This would allow you to effectively encrypt the entire virtual operating system.