Virtual PC

Setting Up a Virtual Machine


Introduction

A "Virtual Machine" is a computer inside a computer. This is done by creating a file that works like a real hard drive. You install the OS just as you would on a real machine. Note that many virtual machine programs support other operating systems such as Linux and OS/2. In this tutorial, we are dealing with the freeware program Microsoft Vitual PC 2007, which supports (what else) only Microsoft operating systems. See Wikipedia - Virtual machine for a list of virtual machine software.

What can you do with a virtual machine? You can test different operating systems, download pre-configured VM files to run on your machine, test programs loaded with malware, then test cleaning programs to see how well they work. You can visit poison sites. You can set up several VM's and run them side by side. You can access files on your actual hard drive with the VM, as well as drag and drop any file out of the VM straight to your own desktop. You can save a VM on a DVD to run on other computers. VM's are dream machines, because no matter what you do, it doesn't actually affect your real computer.

The entire thing is just a large file on your real hard drive. When you partition or format the VM, it's happening within that file, which, to the actual computer, is no different than changing text in a file. Your actual hard drive is never touched.

Hardware Requirements

As stated before, this tutorial is for the Microsoft Virtual PC 2007, which can be downloaded here. As you set up your virtual computer, you'll need to specify how much RAM the computer will use. When in operation, the VM reserves a chunk of your actual RAM to use as its own. Microsoft recommends a minimum of 128megs of RAM for a VM running XP, but keep in mind, many programs require more RAM, so you need to set the RAM as high as possible. It's good if you have at least 1gig of RAM on your computer, so you can allocate 512megs to the VM. Microsoft Virtual PC 2007 device manager

The VM will also be sharing processor power, so the more powerful the CPU, the better. Still, it's the RAM that's most critical, and will affect the performance most.

The VM set up in this tutorial shows its hard drive as 63.9 gigs, with 62 gigs of Free Space. Don't believe it. The VM is actually the .vhd file, which only takes up about 1.4 gigs after a fresh install of XP. It will change size as more programs are added to the VM, but all those gigabytes of free space are parked in virtual reality. They don't exist until actually used.

All the other hardware on your computer isn't important to the VM, which sets itself up as a full computer with its own hardware (virtual, of course). For example, once the VM is set up, you can open it's device manager (pictured at right) and see that the graphics card is listed as an S3 Trio, no matter what your actual graphics are. You never have to worry about drivers with the VM.

Install the Software

Download and install the Microsoft Vitual PC 2007. There are no hidden tricks here. Setup is fairly straightforward. Once installed, open the program, then follow the illustrated steps below to build your virtual PC.

Build it

Virtual Machine Wizard 1) You'll start by building the virtual computer. On the Virtual PC Console, click "New." The New Virtual Machine Wizard will open, as shown at right.

Virtual Machine Wizard 2) Select the option to create a New VM. Don't choose the second option, as you want control over how the VM is set up, and the third option is for experienced users who want to import a preconfigured VM. For now, we are creating one from scatch.

Virtual Machine Wizard3) Name your VM. As seen here, this one will be named GW1.

Virtual Machine Wizard4) Choose the operating system you want to install on dthe VM. Note that the Memory shown in this window reads 128megs. We will change that in the next step.

Virtual Machine Wizard5) The program automatically selects a range of memory you can allocate to your VM, dependent on how much RAM is installed in your real-life computer. With 1 gig of RAM, you can comfortably allocate 512megs for the VM. Some programs, especially graphics and video-editing tools, won't even install without a minimum of 512megs RAM. A simple rule of thumb is to give half your actual RAM to the VM.

Virtual Machine Wizard6) Now it's time to construct the hard drive. Select the option to create a new disk.

Virtual Machine Wizard7) Give the "hard disk" a name. Remember, the virtual "hard disk" is really just a file that is going to be no bigger than the used space in the Virtual Machine. Most computers have plenty of room for this file in the default folder. If you plan on really loading the VM with lots of programs, music files, and whatever, make sure you have the space available.

Virtual Machine Wizard8) You're finished building the machine. Double check to make sure things are as you want them, then click "Finish" and move on to the next step.

Use the Machine

Virtual PC ConsoleYour Virtual PC is now ready to go, and can be seen in the Virtual PC Console (shown at left).You'll notice a button labeled "Settings." Don't bother with any settings for the moment. It's time to boot up. Click the Start button. It's at this point that you can install your operating system.

The screen shot below shows the Virtual Machine booting up just like a real PC. Follow the next steps carefully to begin your installation.

Virtual PC booting for first time

Install the OS

Select boot sourceYou're most likely going to install the OS from a disk, so you want to make your CD drive available to the VM. As the VM is booting up in its own window, click on the CD tab at the top left of the window. Select "Use Physical Drive (whatever)" to engage your CD player. The VM will now boot from the CD, and installation will proceed normally.

You can also boot from an ISO image of an installation CD, by selecting to "Capture ISO Image..." instead, then browsing to the image when prompted.

Note that if you move your cursor into the VM window and click, it may get stuck there. Press the right-hand ALT key on your keyboard to release the cursor back into the real-world computer. This little quirk will be fixed once the OS is installed.

Also note, pressing the right-hand ALT and ENTER keys together will bring the VM to full screen mode, and back. It's best to leave the window in the smaller size for now.

And once again note, if you need to reboot the VM, don't use the ALT + CTRL + DEL method. Press the right-hand ALT + DEL, or select the appropriate command from the "Action" tab at the top of the VM window.

Your VM should now be booting from the CD or ISO, as shown below:

XP installation

The VM behaves just like a real computer. As shown below, you have the same options in partitioning and formatting the virtual hard drive as you would the real thing. Rest assured, you are not actually formatting any part of your real hard drive. All this takes place within the .vhd file.

Partitioning the Virtual Hard Drive

The true face of the Virtual Hard DriveOnce again, though the Virtual Hard Drive reads as 65 gigs in the VM, the actual file on your real hard drive is much smaller. Here, before XP is installed, the virtual hard drive file is only 75 megs in size. This will grow as we add the OS and other programming, but you should get the point.

Finish installing the operating system. We can then move on to tweaking the Virtual PC.

Finishing Touches

With the system now fully installed, there's still the problem of moving the cursor in and out of the VM window. The problem is, the VM still stands as a completely separate computer. We need to tie it in with the real world, so we can access the Internet and files on the host computer. Remove any CD's from your CD drive. At the top of the VM window, select the "Action" tab and "Install or Update Virtual Machine Additions."

Virtual XP

Installing Additions to the VMInstalling the VM Additions is a straightforward task. Just follow the directions.

Restart the Virtual MachineWhen the Additions are finished installing, reboot the VM just like you would a real computer. When the VM finishes rebooting, you should be able to move your cursor in both the real and virtual worlds seamlessly. You'll also be able to drag and drop files between the two worlds.

Virtual Machine SettingsWith the VM now running, we can now go back to the "Settings" button on the Console. This serves as sort of a combination BIOS and Device Manager for the VM. Once the machine is built, some of these settings can't be changed. Settings regarding the Printer Port, for example, can't be changed at this point. Once you have experience in setting up the VM the basic way, as we are doing here, you can set up another VM and incorporate all the Settings options, a process that must be done before booting the VM for the first time.

There are a couple of important settings you can adjust, though.

Network SettingsFirst, make sure the VM Network Adapter is set to NAT. This will enable the VM to use your own Network Adapter to access the Internet.

Note: This setting assumes you are connected through an ethernet card. If the VM can't access the Internet with the NAT setting, try changing it to a different setting. Not all computers are the same, of course.

Adding Links to Drives and FoldersNext, select the "Shared Folders" option. This option allows you to select any folders, or even complete hard drives, on your real-world computer, to be accessed by the VM. Here, the VM has full access to two secondary hard drives, the "F" and the "D".

The Virtual PC is now complete. Shown below, the VM cruises the Net. But keep going, we're not quite done yet.

The Virtual Machine Online

Shutting Off the VMThere are several ways to shut down the Virtual Machine. You can turn it off the way you turn off a real computer, through the Start menu on the VM. The recommended way is to use the "Close" button on the Console. This will give you three options:

Save State; Next time you start the VM, it will return to exactly the same state it was in when closed. It's like Standby.

Shut Down Windows XP; this is the same as shutting down the system from the Start menu. The next time you activate the VM, it will boot from a cold start.

Turn Off; This is the same as unplugging the computer. Any work you're doing could be lost. The next session will start with a normal boot. At least it won't try checking the disk for errors on the next boot.


Congradulations! You should now have a fully operational Virtual PC with which to do all the things you dare not do on your real-world computer. As you get more accustomed to using the program, you can start experimenting with VMs imported from the Net, or you may want to try other Virtual PC programs. Now, go have fun.


Return to Tutorials
or Go to Greenwood Technical

If you have questions or comments about this tutorial, contact me at

EMail