Tuesday, June 16, 2009

Microsoft Virtual PC 2007

In order to have a way to test and develop my server scripts and programs locally, I use Microsoft Virtual PC 2007. Which can be downloaded here.

Since I don't want or have the need for a full version of a server operating system, I'm using a trial version of Windows Server 2003 that can be downloaded here.

Make sure that you download the 32-bit version, since Virtual PC emulates a Intel Pentium III. It's said that it emulates the host CPU on the Windows versions, but I haven't had any luck with that.

The drawback of downloading Windows 2003 is that you have to install it on your virtual hard drive yourself. If you on the other hand want to run Windows Server 2008, you can download it preinstalled on a virtual hard drive here. The evaluation period is initially 60 days, but can be reset 2 times using this tool. Just look under the tab called Delay Activation.

This is the first thing that you will see when you start Microsoft Virtual PC for the first time.

[caption id="attachment_252" align="alignnone" width="367" caption="Microsoft Virtual PC"]Microsoft Virtual PC[/caption]

Click in the New... button, and you will get to a Wizard.


Choose Create a virtual machine.


This specifies what the virtual machine will be called and where the settings file will be located.


Since we called the vmc (Virtual Machine Configuration) Windows Server 2003, Virtual PC automatically chooses Windows 2003 default settings for the virtual machine.


Since the default RAM is just 256 MB, I'm changing that to 1024 since I have the RAM to spare. I wouldn't recommend giving it less then 512 MB though.


Since this is the first time using Virtual PC, you probably don't have a virtual hard disk, so lets create a new one.


The default size of a new vhd (Virtual Hard Drive) is 65536 MB (64 GB). I think that's a bit much, so I'm changing that to 10240 MB. That's enough for Windows 2003 even if you install things like Visual C# 2008 Express Edition.

After that you are finished creating a virtual machine, and you will see this.


Before clicking on Start, there are a few settings that should be changed.


The options are Not connected (no networking available), Local only (networking is enabled, but only between virtual machines), a physical network card on the host machine (makes the virtual machine connect directly to the specified network interface and behave like another physical machine on the network) and Shared networking (NAT) (the virtual machine connects to the network through the host computer). I like to choose NAT here, but if you don't want to bother with networking, just choose Not connected, and enable Shared Folders, as shown below.


As you can see, this cannot be enabled until the virtual machine additions are installed, so I will get to that later on.

Now start the virtual machine. Since there isn't an operating system installed yet, this is what you will see.


In order to solve that problem, click on CD, and choose Capture ISO Image...


Now simply choose the ISO file with Windows 2003, and restart the virtual machine.


Since the virtual machine now have the install CD set as it's CD drive, the Windows 2003 installation will begin.


You get to install the operating system any way that you want to, I won't be covering how to do that here.

Since you need to press Ctrl+Alt+Delete to log in to Windows 2003, there is a slight problem. Ctrl+Alt+Delete is designed to always go to the operating system. So in this case it will go to your physical machine, no matter if you have the virtual machine in focus or not. To solve that problem there is  an option in the menu that you can click on. As you can see, pressing Alt+Delete will also send a Ctrl+Alt+Delete to the virtual machine, so that you don't have to click in the menu every time.


When Windows have booted, click on Action -> Install or Update Virtual Machine Additions. If you are having problems clicking on Action, because the guest operating system have stolen the mouse pointer, press Alt to get it back.


You will get a Wizard that is very easy to follow. After it's done, accept the option to restart your system.

Now you can right click on the folder down in the lower left corner and click Share Folder.


You will get a window to choose which folder from the host operating system to share, and which drive letter to give it.


You will also notice that you don't have to press the Alt key to get your mouse pointer back, it will now be released automatically when you move it out from the virtual machine window.

That's how to get a virtual Windows 2003 machine set up, but this works with most operating system. I have even gotten it to work with Gentoo.

No comments: