Home Development Environment

5/5/2008 11:00:03 PM

Technologies

  • Windows Server 2008 x64
  • Windows Server Core x64
  • Hyper-v RC0

Not too long ago all of my computers decided to die. Within a few months span I lost my main pc, my laptop, and two old servers I had lying around doing various tasks. All of them were rather old and showing their age. As soon as it was available I ended up grabbing a new XPS M1330 from Dell (I highly recommend it as your main machine). However, all the rest of my at home development environment was gone and I vowed that in the near future I would setup a nice cutting edge at home environment to replace it.

Always being a fan of the latest technology I wanted to set up a Windows Server 2008 Core host machine with virtual build, source control, and test web server machines. I figured not only would this be fun to do but would also provide a really powerful home development environment that enables streamlined development and the ability to easily add different types of machines as my needs change. No more old machines patched together laying around my room to perform the odd task. Excellent!

As with any new technology – as of this writing Hyper-v is RC0 – I fully expected to run into numerous issues and frustrations while setting this all up. So I documented the steps I took and with this article I hope to take out some of that frustration for anyone setting up a similar environment.

Setting Up Server Core

The first step that needs to get done is to set up Server Core on your host machine. I picked up a Dell PowerEdge T105 for the host machine. Make sure the computer you use can support hardware-assisted virtualization. I plan to only connect remotely to the host machine but to get it set up I first hook up a monitor, mouse, keyboard, plug in the ethernet cable, and pop in the windows server cd.

Then I set up the BIOS to boot from the dvd drive, boot from the dvd, select server core, select/create the partition and start the install. The server core installation is fast so don't wander too far.

dell power edge t105 setting up windows server core on power edge t105 installing windows server 2008 select server core x64 finished installing windows server core windows server core ctrl-alt-del

After installation you are presented with a ctrl-alt-del screen. Once entered, type in Administrator with a blank password. You will be prompted to set your password after this.

Now that server core is installed you see all you are going to get with this slimmed down OS; a command prompt. After all these years I really think Microsoft needs to improve the look and function of this thing but that is a rant for a different day.

Some general setup has to be done before we can remote into the machine. First I want to baptize my new machine with the name DEV-HOST. Setting the machine name is a simple manner and is done at the command prompt. Make sure to restart the machine so that the changes take effect.

C:\Users\Administrator> hostname
WIN-E9UDT2YOY0C
 
C:\Users\Administrator> netdom renamecomputer WIN-E9UDT2YOY0C /newname:DEV-HOST
(respond to confirmations if prompted)
 
C:\Users\Administrator> shutdown /r

Depending upon how your home network is setup you may have to manually set up your ip address. My home network is a very simple setup. Basically both my laptop and server are connected to a d-link router that is set up as a DHCP server. So the router is assigning my server an ip address. Also, I am using a workgroup instead of a domain.

Setting up the server firewall to allow pings is the next order of business. This is done because you will most likely run into problems at some point and ping is a great tool to help debug them.

C:\Users\Administrator>netsh firewall set icmpsetting 8
Ok.
 
C:\Users\Administrator> ipconfig
 
Windows IP Configuration
 
Ethernet adapter Local Area Connection 3:
 
Connection-specific DNS Suffix  . : earthlink.net
Link-local IPv6 Address . . . . . : fe80::c05:df42:37b3:3dba%5
IPv4 Address. . . . . . . . . . . : 192.168.0.100
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1

Now from a client machine open a cmd prompt and ping the server's ip to make sure it's working.

C:\Users\Evan>ping 192.168.0.100
 
Pinging 192.168.0.100 with 32 bytes of data:
Reply from 192.168.0.100: bytes=32 time<1ms TTL=128
Reply from 192.168.0.100: bytes=32 time<1ms TTL=128
Reply from 192.168.0.100: bytes=32 time<1ms TTL=128
Reply from 192.168.0.100: bytes=32 time<1ms TTL=128
 
Ping statistics for 192.168.0.100:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

Now we can set up remote desktop. To do this terminal services must allow connections and the firewall rules must be set to allow remote desktop connections. To enable the connections for terminal services:

C:\Users\Administrator>cscript %windir%\system32\scregedit.wsf /ar 0
 
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
 
Registry has been updated.

The /ar tag enables connections from Vista and Windows Server 2008 machines. If you are going to allow connections from XP or Windows Server 2003 machines you must also set this for the /cs tag. You can disable this setting by using 1 instead of 0 and to view the current settings use /ar /v. For more information check out this knowledge base article.

Now to set the firewall rules the following command can be used:

C:\Users\Administrator>netsh advfirewall firewall set rule group="Remote Desktop" new enable=yes
 
Updated 1 rule(s).
Ok.

At this point we can remote into the host machine using remote desktop and the ip address. However you may notice that if you try and ping the machine by name you can't resolve the ip.

C:\Users\Evan>ping DEV-HOST
Ping request could not find host DEV-HOST. Please check the name and try again.

So before unhooking the monitor and all other peripherals I enable Network Discovery and File and Printer Sharing so that I can resolve the hostname on the network and also access file shares for easier transfer of files on the local network

C:\Users\Administrator>netsh advfirewall firewall set rule group="Network Discovery"
new enable=yes
 
Updated 19 rule(s).
Ok.
 
C:\Users\Administrator>netsh advfirewall firewall set rule group="File and Printer Sharing"
new enable=yes
 
Updated 16 rule(s).
Ok.
connecting to server core with remote desktop

After setting up Network Discovery and File and Printer Sharing you should be able to access the machine's file share by typing in \\DEV-HOST\C$ in an explorer window. Also you will be able to remote into the machine by machine name using Remote Desktop.

Now that the server core is all set up unhook the monitors, keyboards and such and put your server away in a safe out of the way place, the rest of the work from here on out will be done through remote desktop.

Setting Up Hyper-v on Server Core

Before we can get started with setting up Hyper-v we must download the Hyper-v RC0 x64 from microsoft. After downloading the installation, copy it over to the host machine. This can be done using the file share. I put everything into an installs directory under the admin folder.

copy hyper-v rc0 to install file share

To install the update use the wusa tool as follows:

C:\Users\Administrator\installs>wusa Windows6.0-KB949219-x64.msu

After this installs you must restart the computer then remote back in. Then to enable the server core Hyper-v role type the following and restart again.

C:\Users\Administrator>start /w ocsetup Microsoft-Hyper-V

To verify that the Hyper-v role is installed you can use the oclist command. It is hard to read the output but if you browse through it you should see Installed:Microsoft-Hyper-V.

C:\Users\Administrator>oclist
Use the listed update names with Ocsetup.exe to install/uninstall a server role
or optional feature.
 
Adding or removing the Active Directory role with OCSetup.exe is not supported.
It can leave your server in an unstable state. Always use DCPromo to install or
uninstall Active Directory.
 
===========================================================================
Microsoft-Windows-ServerCore-Package
Not Installed:BitLocker
Not Installed:BitLocker-RemoteAdminTool
(--- removed for brevity ---)
|        |
|        |--- Not Installed:IIS-ManagementScriptingTools
|        |
|
Installed:Microsoft-Hyper-V
Not Installed:Microsoft-Windows-RemovableStorageManagementCore
Not Installed:MultipathIo
(--- removed for brevity ---)
Not Installed:WindowsServerBackup
Not Installed:WINS-SC

With the Hyper-v role installed it is time to set up the actual virtual machines, however since Server Core has no GUI this needs to be done with remote management tools.

Setting Up Remote Management of Hyper-v on Vista

Microsoft provides a Hyper-v Microsoft Management Console that can be used to remotely manage Hyper-v on the host machine. There is both an x86 and x64 version. You must have Vista SP1 in order to install and operate the management console. The recommended way to install Vista SP1 is to use Windows Update. I ran into problems with this because my XPS M1330 uses a SigmaTel High Definition Audio driver that is not compatible with Vista SP1. Vista detects this and prevents the installation. Updating the driver fixed that problem and I was able to install SP1 without further issues.

These are the links to the Hyper-v Microsoft Management Console:

After installing the update you can access the program by going to Administrator Tools -> Hyper-v Manager. If you are setting this all up in a Workgroup environment like me then this is where things start to get messy. After launching the program and connecting to DEV-HOST I would get the error message You do not have the requested permission to complete this task. Contact the administrator of the authorization policy for the computer 'DEV-HOST'.

Instead of re-hashing and doing a poor job of it, to solve this I must defer to the Microsoft team that develops this stuff. John Howard has a solution posted up online that is easy to follow despite it being long (solution).

only root node shown on step 13

There was one step that I had to do a little different. On step 13 I was not able to expand the Root node as per the post, instead when I tried to expand it I would get an empty list. I ended up applying all the security settings to the root node itself and this worked just fine.

I hope this gets streamlined with later releases, although the steps were easy to follow the process was a bit painful and long. It is not something I would expect of final released software. Once this problem was all sorted out and I was able to connect . . . this is some great stuff.

Setting up a Windows Server 2008 Virtual Machine

When setting up the virtual machines we need to first set up the virtual network that they will reside on. After launching the Hyper-v Manager and connecting to the host machine click on the Virtual Network Manager Action. This will bring up a window that will allow you to add a new network. Select an external virtual network and click Add.

creating a virtual network
To set up this virtual network I give it the name DEV Virtual Network and then select the host machines network card as the external network device.
creating a virtual network selecting host network card

With the virtual network setup we can now create the virtual pc. While your connected to the host machine you can create a new virtual machine by clicking on Action -> New -> Virtual Machine. This will open up a simple wizard that will walk you through the steps. First you will be asked to name the virtual machine and specify the location it will reside at. The machine I'm going to create is DEV-BUILD.

creating a virtual machine called DEV-BUILD

You will be asked to specify the amount of memory the virtual machine will use.

creating a virtual machine setting memory

When setting up the network select the external virtual network that you created earlier. In my case DEV Virtual Network.

creating a virtual machine selecting network

Since I'm setting up a brand new machine I create a new virtual disk.

creating a virtual machine creating hard disk

You could select install an OS now but I opt to install it later by selecting the corresponding option.

creating a virtual machine install os later

After finishing the wizard the virtual machine has been created and will appear in the list of machines on the Hyper-v Manager. Since I'm installing the OS from a DVD in DEV-HOST's physical DVD drive I must mount a virtual DVD drive that uses the physical host drive. To do this right click on the virtual machine and click settings. Then click on the DVD drive and select the physical drive that you want to use.

creating a virtual machine mount host drive

Now to install the operating system I connect to the virtual machine by right clicking on it and selecting connect.

creating a virtual machine connecting to machine

After connecting to the machine I get the message that it is currently turned off. To start just select start from the action menu.

creating a virtual machine start the machine

As long as you have the BIOS set to Boot from CD -- this was the default for me -- the installation should launch all by itself. The installation for Windows Server 2008 works just like it would on a physical machine. After booting from the DVD you get the simple installation wizard.

installing windows server 2008 on virtual machine

After installing Windows Server 2008, setting up the Administrator password and signing in you are presented with an initial configuration task screen.

windows server 2008 initial configurations

One of the things you may encounter is that in the lower right you can see this machine is not connected to the network. After digging a little further I realized this was because there are some problems with a bunch of the drivers, one of which is the network adapter driver.

virtual windows server 2008 problem with drivers This device cannot start. (Code 10)

The problem with the VMBus drivers states: This device cannot start. (Code 10). This is happening because on DEV-HOST I have installed the Hyper-v RC0 but on this new virtual machine I don't yet have this update installed. The catch here is that on DEV-HOST I was able to copy the update over the network and install it. With this new machine I can't really copy it over the network since that isn't working. This is easy to get around though since we can just create an ISO of the update and mount it as a drive on the virtual machine.

To create the ISO of the update I use a free program ImgBurn. It is really simple to use. Launch the program and select create image from files/folders.

using imgburn to create an iso

Then select the source file. In this case I browse to the location of Windows6.0-KB949758-x86.msu and set the destination to be Windows6.0-KB949758-x86.iso. Clicking on the folder to image icon at the bottom created the iso.

using imgburn to create an iso

Once this iso is created I copy it into the host machine installs directory I set up earlier. To access the image you go to the virtual machine settings for the DVD drive, select image drive and browse to the iso that you copied over to the host machine.

setting hyper-v rc0 iso

Now that the image is loaded browse to the dvd drive on DEV-BUILD and run the installation. You will have to restart your the virtual machine.

installing hyper-v rc0 from iso

Once the virtual machine boots back up you will see that it is now connected to the network and all the driver issues have been fixed. Now there are just a few administrative tasks that need to be completed.

Naming the computer is the first order of business and can be done through Control Panel -> System -> Advanced System Settings -> Computer Name -> Change. You will need to restart.

I fire up the command prompt and enable ping:

C:\Users\Administrator>netsh firewall set icmpsetting 8
Ok.

Then I go to Control Panel -> Windows Firewall -> Allow a program through Windows Firewall and enable File and Printer Sharing, Network Discovery, and Remote Desktop.

enable windows server 2008 firewall rules

Finally I turn on Remote Desktop by going to Control Panel -> System -> Remote Settings and selecting the appropriate allow connections setting.

enable windows server 2008 remote desktop

Now with those administrative tasks out of the way I can remote into DEV-BUILD and build the best build server on the block!

Comments