How to virtualize Windows on an Ubuntu host for an optimized dev / qa environment

 Ubu-Xu-dows

After converting my MacBook Pro in to a Windows developer dream, I wanted to have the same experience on a more portable, commodity hardware unit. Virtualizing Windows within Windows with VMware Server is something I’m familiar with. It’s something many Windows developers may prefer (and I recommend if you’re not comfy with linux as your host OS).

Quick background: Virtualizing a development/qa environment allows one to have an easily cleaned control environment. When a machine gets dirty (too many installs, tests, builds, or other garbage collects), you can simply delete the virtual instance and copy a fresh installation back over. This saves a ton of time. In dev, this allows a safe, clean, environment to test builds in. In a QA environment, this allows a very fast way to return to a known state.

My goal in a virtualized dev/qa environment is to run a host which consumes an absolute minimum amount of resources. I run virtualization software that allows more than one running VM at a time, such as VMware Workstation (PC), VMware Fusion (Mac), or VMware Server (PC or Linux). If you’re running Windows as your host OS, I recommend Windows 2000 Advanced Server because it is tunable to consume less resources than any other flavor of Windows (including Windows 2000 Professional).

Given that Linux runs on wrist-watch sized systems, it’s a safe assumption that one will get better performance from virtual machines than on a virtualized Windows environment. I chose Ubuntu since it’s super simple to install, is fairly reliable, offers similar features to Windows, and is still a smaller footprint my Win2kAS machines.

I started with version 8.04 desktop (hardy). The installation was a piece of cake, but there are no tuning options in the basic .iso. I installed VMware Server, but just while running the OS I could tell I would run in to performance issues later. The desktop flavor of Ubuntu isn’t light enough to pass all the processing power through to the VMs.

Instructions

1. Install Ubuntu Server 8.04 – For those of you doing this for the first time and are coming from a Windows environment, you should use the following disk setup (assuming you have a single hard drive):

  • 20 GB EXT3 partition, set as boot (“/”).
  • 2 GB SWAP.
  • remaining space, set up for home (“/home”).

2. Install Xubuntu with apt-get – Ubuntu Server doesn’t have a UI. Ubuntu Desktop is too heavy. Xfce is an outstanding light GUI desktop alternative. To get this installed:

  1. Boot up your now Ubuntu Server machine.
  2. You will land at the command prompt, type “sudo apt-get install xubuntu-desktop” (without the quotes).
  3. Enter your password to grant privledges to download/install the Xfce GUI. It will take a while to download as the Xubuntu install is about 300 MB.
  4. Reboot when ready, you’ll boot in to Xubuntu.
  5. At the login prompt, choose to change the type of GUI you’re logging in to. Select Xfce.

3. Install VMware Server (as of this writing, server 2.0 is in beta and not recommended for a performance environment – stick to 1.0.x) – This was a total pain in the butt my first time around. I hope my instructions here allow you a fairly pain-free installation. Additional resources here, here, and here.

  1. Open Firefox, available as a shortcut at the top of the screen.
  2. Download VMware Server here: http://vmware.com/products/server/
  3. It is now on your desktop, go to the Applications button at the top left and choose Accessories -> Terminal to open a terminal.
  4. Type “cd Desktop” to move to your desktop.
  5. Unpack the archive. Type “tar -xvf vmware[TAB]” (hit the tab key to complete the filename).
  6. Move in to your VMware folder. Type “cd vmware[TAB]”.
  7. Visit the ‘here, here, and here’ links above for all the resources you’ll need to get past the now-known errors you’ll run in to.

4. Copy VM instances from other systems – I use VMware Fusion on my Mac and VMware Workstation on a PC (haven’t used Workstation in a while). You can create instances in either of these products and then just copy them over to your Ubuntu system. Tips:

  • Keep the fresh install VM instances as they are and make copies. You can now just drop in a copy of the fresh install so you don’t have to ever re-install the OS again.
  • Install your dev and/or qa environment. Make a snapshot NOW. You can now revert to this snapshot immediately, whenever you want. Fresh, known, starting point: viola!

5. Tweak your VMware instance settings:

  • Leave your host OS enough RAM to be comfortable. Give each VM as much as it needs.
  • Disable 3D acceleration unless you absolutely need it in the VM for testing 3D. This is a resource hog.
  • If your PC is multi-core, only give the VM 1 CPU (unless you need to test multi-core software).

6. Dev and QA to your heart’s content – You’re now free to revert, take snapshots, and otherwise manipulate your OS without the fear and wasted time of reinstallation. Enjoy!

3 thoughts on “How to virtualize Windows on an Ubuntu host for an optimized dev / qa environment

  1. Just curious, is there a reason you didn't download XUBuntu directly via ISO image and install that way vs. going with the Ubuntu Server and then installing XUbuntu?

    Also, have you had any experience with VirtualBox vs. going with VMWare Server? I have used VMWare server with WindowsXP Pro as the host and Ubuntu as the VMWare instance and found it to be slightly sluggish (to the point it was noticeable and annoying). This was on a quad core PC desktop with 4GB of RAM so it wasn't lack of hardware.

  2. The thought was that 8.04 server, with a minimal installation, and then adding a UI would have less services running than a full blown desktop installation. I haven't benchmarked the system with one configuration vs. the other, but our desktop instances appear snappier with this approach. I'd love to have a guru describe if this is the case.

    I just installed VirtualBox yesterday. It's a nice system for desktop use. Haven't benchmarked it yet. I lean towards VMware because our company utilizes a lot of their tools. Being able to drop a finicky VM out of our cluster and on to my desktop for analysis is awesome.

Leave a Comment

Your email address will not be published. Required fields are marked *