Many of you may know that I’m a huge fan and user of Virtual PC and Virtual Server for development purposes, specifically SharePoint development. Both Virtual PC and Virtual Server are Microsoft Products and both are free to use and provide big advantages when developing solutions for SharePoint 2007. When a server instance has been vitrualized it is referred to as the “Guest” operating system and is often called the “Virtual Machine” or “VM”. The “Host” system is the physical computer that runs the Virtual PC or Virtual Server software and has the ability to host multiple guest virtual machines (VMs). Now with the VM hosting role built into Windows 2008 Server and the Hyper-V technology, scalable virtualization is built right into the Windows operating system.
Some of the biggest advantages to doing development within a VM are:
1. The host machine and guest VMs can be running different operating systems, they can even be running different processor types (32 bit vs 64 bit) I typically do development on laptop running Windows Vista Business and run Virtual PC to run guest operating systems like Windows 2003 Server.
2. Once you have a library of “base” VMs you can quickly and easily spin-up a new VM and customize it.
3. VMs run in a an isolated environment so you can create virtual environments or virtual networks to simulate different networking and SharePoint farm topologies.
4. VMs are stored within a single file which makes them much more portable. This allows you to quickly move them from one host to another host with ease.
I’ve been using virtualization exclusively for software development for about two years now. Sure, there’s a slight performance hit, but you can’t beet the flexibility you gain from having one (or more) isolated development environments. Before I started using Virtual PC, it was common for me to be wiping my laptop once every 4 to 6 months. Now, since I don’t run any development tool software on my host OS, it’s rare that I have to rebuild my host machine. And, of course, creating new virtual PC’s is a snap. The following article is written as a guide to getting the most out of doing SharePoint development work using virtual machines.
1. Create a Library of Virtual Machine Images
In order to quickly create development environments I have created “base” VM images and preconfigured environments. With disk space being as cheap as it is today do not be afraid to create many different VMs. My base VM include : Windows 2003 Standard, Windows 2008 Enterprise, Windows 2008 Enterprise R2, etc. My preconfigured SharePoint environments include: MOSS 2007 RTM running on SQL Server 2005, MOSS 2007 SRTM running on SQL Server 2005 SP2, MOSS 2007 SP1 running on SQL Server 2000, WSS3.0 running on SQL Server 2005 Express, etc. You get the point.
2. Create Virtual Machine Images with Development Tools
Another huge time saving tip is to create full blown development environment VMs that have all your standard development tools installed and configured. Be sure to save a copy of the development environment VM as a “base” so that you can quickly spin-up a new one for your next project. Some of the tools I have installed on my common development environment VMs include: Visual Studio 2008, SharePoint Designer 2007, Visual Studio Extensions for Visual Studio 2008, WSPBuilder, STSDEV, etc.
2. New Image for Each Project
One of my favorite tips is to create a new VM for each project that I work on. I work with many different clients at a time and each of my clients has a different variation of MOSS software installed (SQL versions, OS versions, MOSS service packs and patches, etc) so I like to create a new VM for each client project that matches their exact environment. I’ve found this to be extremely useful when trying to debug an issue for a client because I can quickly recreate the issue on my VM that matches their environment.
3. Use External USB Drive and have plenty of RAM
The best performance mix I’ve found comes from running my VMs from an external USB Hard Drive so that the operating system on the guest VM and the host PC don’t compete for disk. I’ve also found that having more than 3GB of RAM on my host machines is best, I typically give allow my guest VMs to have about 1.5GB of RAM which leaves 1.5GB of RAM for my host machine. You may find that you can get away with only 2GB or RAM on your hosting computer if you are running WindowsXP but I typically run Windows Vista on my computers so I like to have 3GB of RAM. Note: 3GB or RAM is the minimum I recommend, if you want to host multiple VMs on a single host computer you’ll more than 3GB.
Additional Information and Links
Instructions for configuring a SharePoint 2007 development environment
Microsoft Windows 2008 Server with Hyper-V