Working for a Microsoft shop, you get used to only using Microsoft products, it’s only when one of doesn’t work you go and look at the alternatives. Getting ready for the imminent public beta release of SharePoint 2010 I decided to set up a new virtual machine with Windows Server 2008 and SQL Server 2008 on my 64-bit Windows 7 machine. I downloaded Windows Virtual PC, created a new virtual machine and pointed the DVD Drive to the Windows Server 2008 ISO. I started the VM and…
“CPU not compatible with 64-bit mode.” Yes it is. I even flashed the BIOS to make sure that I could enable AMD-V for the chip. Hmmm, what now? Google!
Amongst the Virtual PC and Hyper-V results I stumbled across VirtualBox. Seemed to do what I needed it to and while it didn’t specifically mention Windows Server 2008 in the list of guest operating systems I took the chance and downloaded it. It’s a neat little program, nice interface and on creating a new virtual machine I discovered that it does indeed support Windows Server 2008 (64-bit). Result!
I ran through the rest of the setup process without a hitch and then adjusted the settings to mount the Windows Server 2008 ISO and set the Network Adapter.
Next, I started the VM and ran through the normal Windows setup procedure, again without a hitch, and voila!
I decided to do a bit of tinkering while waiting for the SharePoint beta release, so after installing IIS and SQL Server 2008 and all the requisite updates I wondered if I could host a website on the VM and access it externally. Turns out that’s quite easy to achieve. A quick browse through the user manual and I found Configuring port forwarding with NAT. I’ve configured the guest to use the Intel PRO/1000 NIC rather than the PCNet one so have changed pcnet to e1000, so the following script will forward TCP connections on port 4321 on the host to port 1234 on the guest.
cd "C:\Program Files\Sun\VirtualBox"
VBoxManage setextradata "SP2010" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guestssh/Protocol" TCP
VBoxManage setextradata "SP2010" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guestssh/GuestPort" 1234
VBoxManage setextradata "SP2010" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guestssh/HostPort" 4321
All that remained was to enable port 4321 on my firewall and forward connections to the host machine, the host machine then took care of forwarding to the VM, and I could access the website residing at port 1234 on the virtual machine!
Note: These were not the actual port numbers I used, and even if you did guess correctly all you’d get is a one word HTML test page!