Monday, February 28, 2011

Hyper-V Templates for SharePoint 2010 using Sysprep

I’ve decided on a very simple farm for my first attempt at virtualising SharePoint 2010 at home – I’m creating 4 servers.

Server 1 is a domain controller. I’ll reuse this server over and over again. So once it is set-up, I’ll take a copy of the virtual hard drive. In the case I need to start from scratch, I can. I’ll allocate the DC 512meg RAM as this is the Windows Server 2008 R2 minimum spec, and it’s not exactly going to be taxed controlling a domain of 4 servers.

Server 2 is a SQL Server. Again, I’m likely to reuse this server, so I’ll take a copy of the VHD. I’ll allocate 4096meg RAM to this server

Server 3 and 4 are web and app servers respectively. Again, 4096meg RAM each.

Creating multiple servers is actually pretty easy in Hyper-V.
- I started by creating a single server running Windows 2008 R2, and installed all the latest updates, service pack 1, and enabled things like remote desktop.
- Next I shut down the VM I have just created, and logged in to the host and took a back-up of the VHD. This will be useful later when I need to update my base image (or, potentially, install things like a virus scanner by default)
- Next, restart the VM. Once in windows run the sysprep utility. As it turns out, sysprep comes with Windows these days and can be found at C:\Windows\System32\sysprep
- I selected the following options;
image
Selecting generalize ensures a new SSID is created each time the image is used so the machines don’t clash.
- Sysprep will do its thing, and then shutdown the machine. At this point, take a copy of the VHD and mark it as read-only. This is your system template
- I copied the VHD 4 times, one for each server I wanted created. Then I created 4 new VMs, each attached to one of the copied VHDs with the appropriate amount of RAM and fired them up.

There you have it. 4 servers created in the time it takes to install 1 OS Smile.

Sunday, February 27, 2011

Remote Management for Hyper-V

As part of my virtual lab project, I want to be able to manage my virtual machines from my lap-top. It’s usual practice in most organisations to only remote in to servers when absolutely needed, so I’m going to take the same approach at home (may as well replicate a real environment as much as I can!).

First things first, I’m going to need the Hyper-V MMC snap-in for Windows 7. The remote server administration tools (RSAT) can be found on MS here;
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=7d2f6ad7-656b-4313-a005-4e344e43997d&displaylang=en
Once you’ve installed that, you’ll need to enable the hyper-v features using the ‘Turn Windows Features on or off’ link in Programs and Features in control panel.

Next you’ll need to configure the hyper-v role on the server to allow you to administer it remotely; by default, if you add the server to the hyper-v manager in Windows 7, you’ll get an error stating you don’t have permissions. In my set-up, the virtual host and my lap-top are both workgroup computers, any domains I set-up will be at the guest level. Getting it to work when both computers share a domain is straight forward, when they’re in a workgroup, not so much. A quick Google search pointed me to HVRemote, a script written by John Howard. His blog can be found here - http://blogs.technet.com/b/jhoward/ and the script can be found on MSDN here - http://archive.msdn.microsoft.com/HVRemote.

Following the instructions for workgroup-workgroup configuration on the MSDN page – and it works.

Setting up a Virtual Lab for SharePoint 2010

So - having always run virtual machines on my lap-top with the previous version of SharePoint, its 4gb of RAM just isn't enough anymore. I figured I may as well take advantage of rock-bottom hardware prices and set up a virtual lab.

For home use, consumer grade hardware is perfectly capable of hosting virtual machines reliably, so I logged on to Umart to see what was on offer.
After a while, I settled on an AMD based system, as the prices seemed lower for what I wanted to do (raw computing power per dollar was higher). I settled on the following hardware;
AMD Phenom II x6 1055t
Gigabyte GA-870A-UD3 motherboard
Kingmax 8GB (2 x 4GB) DDR3 RAM kit x 2
Western Digital 1TB SATA3 Harddrive x 2

I stuck it all in an Antec NSK6582b case, with an Earthwatts 430w powersupply.

I plan at a later stage on installing a couple of extra hard drives and getting a RAID array going for performance, which the motherboard will support, but that is a battle for another day.

All in all, I've ended up with a 6-core, 16GB RAM machine for under $800. Since the whole thing is for dev and testing, my TechNet subscription will cover any licensing, so I went ahead and installed Windows Server 2008R2 and configured the Hyper-v role.
Now to create a virtual machine template using sysprep... let the games begin!