Hardware

SolutionBase: Building an all-in-one test lab using Virtual PC 2004

Build a test lab for your entire organization using one PC.


In a perfect world, your IT budget would be large enough for you to build a huge lab for your organization, where you could test different configurations and scenarios before rolling them out to the general public. You could have every combination of operating system and application software, and crash and rebuild things at will.

Unfortunately, you don't have a huge testing lab at your disposal. You're probably lucky if you have one extra PC to spare. If you do have only one spare PC, you can turn it into an entire testing lab using Virtual PC 2004.

What does Virtual PC do?
Virtual PC 2004 allows you to run multiple operating systems, or multiple configurations of the same operating system, on a PC without having to worry about configuring any complex multiboot settings.

What makes Virtual PC so nice is that you can save images of the various operating systems and configurations. This gives you the freedom of doing anything you want to an operating system without fear of crashing the core operating system or affecting other virtual PCs that reside on the system.

For example, most of the articles that I write involve demonstrating how various technologies work. I never know from one article to the next if I’m going to need a Windows server, a Linux server, a Windows workstation, or something else. The machines generally work pretty well, but about once a month, I end up messing up a machine pretty badly while experimenting with a technique; then I have to reinstall everything.

If I manage to destroy a virtual PC, or if I want to set it back to the way it was before I started working on an article, it's easy to revert to a previous state. For me, Virtual PC has been a huge time-saver. Virtual PC isn’t just for technical writers, though. Developers can also use it to make sure that new software will run on a variety of operating systems.

Some companies also use Virtual PC to aid in software deployments. They can test a new software package by loading it on a virtual PC. Likewise, if a company wants to upgrade to a new operating system, but a legacy application won’t work on it, users can run the legacy application on the new operating system through a virtual machine. As you can see, Virtual PC has lots of different uses.

Acquiring Virtual PC 2004
Virtual PC 2004 is available from Microsoft for $129 per license. The license allows Virtual PC to be installed on a single computer and permits you to set up as many virtual machines as you want. (But you must purchase licenses for any operating systems being used by virtual PCs.)

Prior to Microsoft’s acquisition, Virtual PC was owned by Connectix and used the name Connectix Virtual PC. If you're a Connectix Virtual PC owner, Microsoft is offering free upgrades to Virtual PC 2004.

System requirements
Virtual PC 2004 requires a minimum of a 400 MHz processor (1 GHz is the recommended minimum) and 20 MB of free disk space. These modest requirements are deceiving, though, because those are only the requirements for the software, not for the virtual PCs themselves. Each virtual PC that you create will require additional resources. For example, if you set up a virtual PC that’s running Windows XP, you'll need an additional 2 GB of disk space and 128 MB of memory.

Virtual PC 2004 is designed to run on machines with Windows 2000 Professional or Windows XP Professional. I've used Virtual PC 2004 on Windows 2000 Server, but this configuration isn’t supported by Microsoft.

Installing Virtual PC 2004
Begin the installation process by double-clicking the Setup file. When you do, Windows launches the installation wizard. Click Next to bypass the wizard’s welcome screen, and you'll be asked to accept the product’s end-user license agreement. Click Next and then enter your name, your organization’s name, and the product key. Click Next and Install, and the wizard will begin to copy the necessary files to your PC. When the installation process completes, click Finish.

Creating your first virtual machine
You can launch Virtual PC 2004 by selecting the Microsoft Virtual PC command from the Programs menu. You'll see a warning message indicating that Virtual PC is intended to run on Windows 2000 Professional and Windows XP Professional only. Although these are the only operating systems that Microsoft officially supports, I've been running Virtual PC on Windows 2000 Server with no problems.

After you clear this warning message, you'll see that Virtual PC has launched the New Virtual Machine Wizard. This wizard will help you install your first virtual machine. Click the Next button to clear the wizard’s welcome screen; you'll then see the screen shown in Figure A.

Figure A
You must choose how you want to create a new virtual PC.


Let's take a look at the options on this screen. The first option lets you create a new virtual machine. It causes the wizard to walk you through a series of questions aimed at creating a virtual machine that performs exactly to your specs.

The second option lets you create a virtual PC using the default settings. This option saves you from having to answer a bunch of questions. One problem, however, is that there will be no hard drive associated with the machine that is created. You'll have to either create or designate a virtual hard drive later if you choose this option.

The last option allows you to add an existing virtual machine. Use this option if you want to copy a preexisting virtual PC from a different physical computer. For example, if you were teaching a Windows XP training class, you could set up one Windows XP virtual machine and then copy that to all of the computers in your classroom rather than having to repeat the setup process for each computer.

Now let's create the virtual PC. Select Create A Virtual Machine and click Next. You'll be asked to enter a name for the new virtual machine. Technically, you can get away with using the default name, but it’s usually better to use something more descriptive. For example, you might name the virtual machine based on the operating system that it will be running.

Click Next, and you'll see a screen that asks what operating system the virtual machine will be running. Your selection will allow Virtual PC to automatically set up the appropriate amounts of memory and hard disk space for the new operating system. If you're installing an operating system other than the ones listed, you can either select an operating system with comparable hardware requirements, or you can choose the Other option. For the purposes of this article, I'll choose Other.

The next screen asks how much RAM you want to use for the virtual machine that you're creating. Virtual PC allocates 128 MB by default, but you can adjust the amount based on the guest operating system’s requirements.

The wizard’s next screen asks if you would prefer to use an existing virtual hard disk or if you want to create a new one. Since this is the first virtual machine that we’re creating, select the option to create a new virtual hard disk and click Next. You'll then be prompted for the location of the virtual hard disk. The default location is almost always acceptable unless you need to move it to a volume with more free space. Click Next, and you'll see a summary of the installation options that you’ve chosen. Click Finish to create the virtual machine.

Setting up an operating system
After you create your first virtual PC, it will appear within the Virtual PC Console, as shown in Figure B. In the figure, notice that my virtual PC is called Red Hat Linux 9—the name I assigned to the virtual PC. The virtual PC does not yet contain Linux or any other operating system.

Figure B
The virtual PCs appear in the Virtual PC Console.


Also notice the four buttons to the right. You can use the New button to create additional virtual PCs, or use the Remove button to delete the selected virtual PC. The Settings button allows you to modify the settings for the currently selected PC, and the Start button launches the selected virtual PC.

I'll walk you through additional settings later on, but for now, let’s install an operating system. To do so, I've created a bootable floppy disk with CD-ROM drivers on it. This will allow me to boot the virtual PC from a floppy disk and then run the Linux Setup program off a CD. To begin the process, just select the virtual machine and click Start.

The virtual PC will boot from the floppy and load the CD-ROM drivers. The system will assign the drive letter C: to the CD-ROM drive because, although a virtual hard disk has been created, it has not yet been partitioned or formatted. Since I booted my system with a DOS disk, I'm using the FDISK command to create a partition, which I'm then formatting (Figure C).

Figure C
You must partition or format your virtual hard drive if the operating system requires it.


After partitioning the virtual hard disk, FDISK tells you that you must restart the machine. Pressing [Ctrl][[Alt][Del] will not work because doing so invokes the Windows Task Manager. Instead, you must close the virtual PC window. Virtual PC asks if you want to save the state. Saving the state is similar to putting the virtual PC into hibernation. Rather than saving the state, just use the Turn Off option. This will take you back to the Virtual PC Console, where you can restart the virtual PC.

After you've formatted the hard drive and begun installing the operating system, you might receive a message indicating that Virtual Machine Additions are not installed. Virtual Machine Additions boost performance and allow you to use things such as the mouse, folder sharing, and time synchronization. If you receive such a message, you can install the Virtual Machine Additions by selecting Install Or Update Virtual Machine Additions from the Action menu. The installation process is pretty simple and straightforward, but is necessary only for machines running Windows operating systems within virtual PCs.

Installing an operating system on the virtual machine is identical to the installation process on a physical machine. The only difference is that it can be a lot slower. My 1.8 GHz Pentium 4 took nine hours to install RedHat Linux 9 on a virtual machine.

Additional settings
Earlier I mentioned that there were additional settings you could use to fine-tune a virtual machine. You can access these settings by selecting the Settings command from the virtual machine’s Edit menu. The only problem with doing so is that some of the settings cannot be modified while the virtual machine is running. Therefore, if possible, it's better to alter these settings outside of the virtual machine.

To do so, return to the Virtual PC Console, select the virtual machine that you want to modify, and then click the Settings button. You'll see the screen shown in Figure D.

Figure D
The Settings dialog box allows you to fine-tune the virtual machine.


The File Name option lets you rename the virtual machine, while the Memory option lets you reconfigure how much memory you want to allocate to the machine. In the figure, you may have noticed that there are options for three different hard disks. You can use these options to link up to three virtual hard disks to the virtual machine or to switch to a different virtual hard disk.

The CD/DVD Drive, Floppy Disk, COM, Sound, and LPT1 options are pretty self-explanatory, but the Networking option is worth taking a look at. This option allows you to control whether the virtual machine is able to establish a “real” network connection. My definition of a real network connection is one that passes directly through the NIC. As an alternative, you could establish a NAT-based networking session that passes requests through the host operating system rather than directly to the NIC. Of course, you also have the option of disabling networking completely.

Another option that needs a little explaining is the deceptively simple Mouse option. This option allows you to enable pointer integration—the ability to move the mouse pointer between the virtual machine and the host operating system seamlessly. Pointer integration can be enabled only after an operating system has been installed on the virtual machine.

The Shared Folders option also needs some clarification. It allows the virtual machine’s operating system to access folders on the host machine’s hard drives. Although this is a handy option, you have to be careful when using it because you can really disrupt the system if you aren’t careful.

The Display option gives you the choice of restricting screen resolutions, hiding the virtual machine’s menu bar and status bar, and running the virtual machine in full screen mode. The final option, Close, lets you choose which options are available when shutting down a virtual machine.

Earlier I mentioned that you can save a virtual machine’s state so that any changes made to the virtual operating system can be rolled back. This is done through an option that I intentionally skipped over until now—the Undo Disks option. If you enable Undo Disks, you're given a choice when you shut down the virtual machine: You can commit the changes to the virtual hard drive, save the changes until the next session (without committing them), or delete the changes altogether. If you enable Undo Disks, you'll need free space on the physical hard drive in addition to the space that you've allocated to the virtual hard drive.

Build your own minilab
Virtual PC 2004 is extremely useful in development environments. You can also employ it to support the use of legacy applications that don't function on the current operating system.

Editor's Picks