Tuesday, 7 April 2009

Building the base images and making them immutable (read-only) - Part I

So, today I am going to cover building the base images for a Windows Server 2003 development environment. I'm not going to step through how to install Windows 2003, there are plenty of other documents that describe that elsewhere on the InterWeb. Instead I'll describe the important bits of VirtualBox to help those starting out with this. I will begin with an overview of the disk types in VirtualBox we are going to use and what they mean.

So, there are two types of disk of importance to this tutorial.
  1. Normal Disks: Just standard read/write disks implemented through either files on the filesystem OR as raw partitions on a physical disk (advanced and not what we do here!).
  2. Immutable Disks: These are read-only disks attached to a virtual machine that aren't changed as a result of anything that goes on during usage of the machine and perfect for what we want to achieve.

Other types will become evident in later tutorials but for now these are all we need to care about.

So, without further ado lets describe the process of creating an immutable base Windows 2003 image!

Stage 1: Create the first Virtual Machine

This bit is fairly easy, but essentially I create a Virtual Machine named "W2K3_Base1_NoAD" with as much memory as I can - usually just under 50% of physical memory. When it comes to selecting the Hard Disk for the virtual machine I select "New" and the new disk wizard pops up. skip through the first screen and on the "Storage Type" screen ensure "Dynamically expanding storage" is checked. This ensures we have the smallest image we can for the immutable base image. Select a location for the disk - I use the structure in the following diagram but this requires some config file hacking to make it so clean (see later - and heed the warning!!") - and a size. For the size I have found 20Gb is about the right size for a good W2K3 install + a few server products such as BizTalk Server 2006 R2 and MOSS 2007, etc. Once you have this click "Finish" on the next page and this new disk should be the disk selected back in the Virtual Machine wizard. Click "Next" and "Finish" to finish the creation of the virtual machine.

Job done. All that remains is to do some final "tweaking" of the machine config so we can begin installing. If you select the machine in the left hand column of VirtualBox and click "Settings" you can tune the underlying "hardware" of the virtual machine. On the presented "General->Basic" settings page I usually crank up the Video Memory to 32Mb. Not sure it matters too much but it makes me feel better. On the "Network Settings->Adapter1" I set the "Attached to:" value to "NAT" as this is the only combination that works on my laptop due to some wierd low level firewall drivers being installed. incidentally the same reason I can't use VMWare on this laptop either. NAT works though, and - as a bonus - works very well.

That's it. You are now ready to power on the machine and install your favourite (or required!) OS - which for this is Windows Server 2003 R2 if you hadn't already guessed!

Stage 2: Install the base Windows 2003 Server software

This bit is pretty easy and I won't bore you too much with the details. The hardest thing here is pointing the CD/DVD to either the physical media or an iso image of the installation media. I choose the latter because I download them from my MSDN subscription. Doesn't really matter which one you use as long as the media is valid and you have a valid key.

Attach a CD/DVD by one of 2 methods (well, 3 but I am leaving the command line alone for now - a future tutorial perhaps). Either select the virtual machine in the VirtualBox console and select the "CD/DVD-ROM" page. In the property sheet select the "Mount CD/DVD Drive" option and then point to the physical drive with the CD/DVD in or select the "Virtual Media Manager" button highlighted on the right in the diagram below (click to "Go Large")


The same functions can be accessed using the "Devices->Mount CD/DVD" menu options when the VM is powered on.

Power up the machine and walk through the chosen OS installation routine.


Once this is complete, let the machine reboot and log in. You can choose to carry out a "Windows Update" now, which I tend to do to make sure the server is as secure as possible before exposing to incoming network connections, or leave it until you have installed IIS 6.0. Since an IIS requirement is pretty ubiquitous in the world of .NET training and development I have chosen to have this as part of the very base installation.

Once you have installed all the required base components do a Windows Update again and then you are good to compact the disk to use the smallest space possible.


To be continued tomorrow ....

Monday, 6 April 2009

What is the VM configuration I want to build?

I've been messing with WSS and Biztalk for a while. I also spend some time looking at BPM products, mostly a product from SourceCode called K2 at the moment. Building all these products onto a single image and then doing stuff and then having to rebuild on some kit that's pretty slow by all standards is becoming a pain.

So, what I wanted was a base set of disks installed with Windows 2003 R2; one without Active Directory because you never know and one with Active Directory and DNS. From the AD base I want to add SQL Server 2005 and SP2 since this is pretty much required for most developments.

From this I then want to install Visual Studio 2008 and then finally branch from this for each of my MCTS individual exams - each may require slightly different configs.

From the SQL Server machine I would also like to branch a Visual Studio 2005 Machine so I can install and play with K2.BlackPearl. Sadly the Visual Studio 2008 integration for this isn't available yet.

Here's the picture of the configuration I am trying to build with VirtualBox (Click Image to view larger).


Tomorrow I will walk through how to build and configure the base images and then how to protect them.

Sunday, 5 April 2009

Best start this blogging lark ...

It was a long time ago in a village far, far away ... or Reading (UK) and about 12 months ago to be precise ... when I was chatting to an account manager from good old Microsoft.

The essence of this conversation was ... do you blog?

Well, actually "No, I don't. Somehow I can never find the time, our company doesn't really support it, blah. blah. blah". There always seemed some excuse for not doing it; in reality I was probably not giving it the attention it deserves.

So, here I am blogging and I have some stuff to blog about which always helps.

I've spent the last 2 days building some virtual machines for my studies and a few other bits and bobs. My recent infatuation began about 2 weeks ago when I had a conversation with a colleague aboout "differencing disks". Until that point - never heard of them. Now I'm almost an expert of 2 weeks experience!

So, I did some reading and I found this artcle - "HOW TO: Use Virtual PC's differencing disks to your advantage". It's an excellent article but sadly uses Virtual PC. Now, this in itself isn't too bad but I have a nice Gentoo system at home which I really like. It generally does what I want (except when I install KDE 4.2 and really mess it up!) quickly and with minimal memory demands. I also have a nice knoppix USB stick to boot my laptop from so I don't touch the work's hard disk. So, what I get around to thinking is ... can I do this on Linux and Windows, sharing between the two depending on whether I am working at work (Windows XP) or at home (Linux)?

Looking at the options I see VMWare and VirtualBox. I've never managed to get VMWare working on my gentoo (not really put much effort in mind you) but it would have been nice since it works without much messing on Windows and Linux. It has a nice remote interface via HTTP and it generally works pretty well.

However, being a nice Open Source advocate - which I have been for many years - I thought this nice "VirtualBox OSE" edition must be good. It's free, it's open source and it's written by SUN.

So, the challenge I set was to reproduce the method described in the article above (not to be confused with METHODOLOGY - that is the study of methods and not the implementation of a method!!! - see Methodology - pet hate out of the way now!)

In the next few days I will document my findings. I used some intuitive hacking to determine how to do this because the documentation didn't really cover it. I will also be developing a nice little BPM app on K2. The reason for this - I was set a nice problem to solve in a 'meeting' recently and thought it would make a good end-to-end process for me to waffle on about and show my breadth of skills - which, after all, is what blogging is all about!!

I also have a few bits-n-bobs to add into the VirtualBox codebase if I get time, certainly I will be adding some feature requests after my experiences over the past 2 days. A chance to do some C++ coding for a change. Also probably write a nice little utility in C# using Mono (Linux) and VS 2008 (Windows XP) since it is difficult to move between the two systems without modifications to the various configuration files for VirtualBox.

So, enough for now, I'm Midnight Coding again and I have to be up for work tomorrow.