Get started with virtual machines

It's great to have multiple computers. On the first of them, you can install a database or crunch spreadsheets. On another, you can simply browse the Web, listen to music, and check your e-mail. Yet another can have a supercharged configuration for playing games. Sure, you could have all of your programs on the same, single computer, but some applications--such as games--can't run concurrently with other programs.

Many businesses have a different problem: They need to use applications that will run only on a specific operating system, be it Windows Vista, XP, or 2000, or maybe Mac OS X or Linux. So they maintain computers running different OSs around the office.

Using multiple PCs has several drawbacks, of course, such as the amount of money they cost and the power and space they consume. You can always install a second operating system to dual-boot with your existing OS, but dual-booting requires repartitioning the hard disk, as well as shutting down one operating system and its applications in order to use the other.

Thanks to today's faster processors and capacious memory and disk space, however, you can get many of the benefits of using multiple, separate computers by adding virtualization software to a single PC. Such software lets you install multiple OSs into virtual hard disks that are really just files on your main hard drive. You can then launch and run multiple guest operating systems simultaneously. The software redirects access to key hardware devices on the host system, including network adapters and optical drives. Although the virtualized operating systems themselves are not always free, several excellent virtualization utilities don't cost a cent. VMWare's VMWare Server and Sun Microsystems' VirtualBox come in multiple versions that run under either Linux or Windows, allowing you to host either Linux or Windows. Microsoft's Virtual PC 2007, not surprisingly, runs only under Windows--but it does permit you to run Linux as a guest operating system, surprisingly.

Other virtualization tools abound (notably, the Mac-based VMware Fusion and the multiplatform Parallels Desktop), but for this story I'm going to focus on three excellent, free virtualization apps as I guide you through the process of installing and configuring multiple OSs on your Windows PC. You can run just about any OS (except for Apple's, which is restricted to Mac hardware) in your virtual machines, and you can run the virtualization software on many different host operating systems. Virtualization is all about expanding your options.

Though you'll see the best performance with fast processors, multiple gigabytes of memory, and large virtual hard disks, some virtualization tasks (including all of those described here) can run on systems with 512MB of memory or less. If virtualization doesn't meet your needs for whatever reason, or if you just aren't satisfied with a particular virtualization app, simply uninstall the software and delete the virtual hard-disk file to return your PC to its previous state.

Scenario 1: Host Another Version of Windows, Under Windows Using Virtual PC 2007

If Windows XP floats your boat but you've sailed onward to Vista, an occasion might arise when you need to reverse course and return to the earlier Windows version. The ability to do so is especially handy if you're having trouble getting a favorite XP application to behave in Vista. It's also useful if you want to run even older versions of the OS, such as Windows 2000.

Microsoft's Virtual PC 2007 is the perfect fit for this virtualization scenario. According to Microsoft, the main host operating system versions supported are Windows Vista, Server, and XP Professional (32-bit and 64-bit versions), though I installed the app successfully in Windows XP Home Edition with just a brief warning that it was not supported.

When you launch Virtual PC 2007 for the first time, it displays a console listing your Virtual Machine components (which will be empty at first) and a New Virtual Machine Wizard. Click Next to start the Wizard, and click Next again, thereby choosing the default option to create a virtual machine. The wizard then asks you to confirm the amount of memory and disk space to dedicate to the virtual machine. I accepted the default memory size, but adjusted the amount of space dedicated to the virtual machine's file-based virtual hard disk downward to avoid eating up all of the free space on my host hard disk.

How much memory you devote to your virtual machine will determine how quickly it performs, but remember that any RAM you give to the virtual PC will come at the expense of its host system. If you have 2GB or more memory on your host PC, consider giving a virtual XP machine 512MB, which will ensure reasonably fast performance.

Click the final Next, then Finish, and your virtual machine will appear in the Virtual PC Console. Insert an operating system installation CD and double-click the virtual-machine icon in the Virtual PC console to start the boot process. You may need to select the CD/DVD boot drive in the Virtual PC's CD menu, choose Action, and then press Ctrl-Alt-Del to make the virtual machine boot from its installation CD or DVD. After that, the installation process should proceed just as it would on a non-virtual PC. You can install as many different virtual OSs as your hard-disk space will allow.

Virtual PC 2007 is pretty simple to use, because it has only a few options. To boot up an installed virtualized OS, select it in the Virtual PC Console and click Start. To save the current state of the OS (in order to exit Virtual PC or shut down the computer), click on Close, choose Save state from the list of options, and click OK. Clicking the mouse within the virtualized OS window once allows it to "capture," or recognize, the mouse pointer. To release the pointer for use in the host OS, press the right-hand Alt key and drag the mouse out of the Virtual PC window. Choose Action, Full Screen Mode to view the OS in a full screen, and press the right-hand Alt plus Enter to escape to the host OS.

Once your virtual machine is up and running, click Action, Install or Update Virtual Machine Additions in the Virtual PC menu. This will install a variety of tools that allow you to copy and paste text between the virtual machine and the host PC, as well as to send documents back and forth via a shared folder on the host PC.

Scenario 2: Host Linux Under Windows, Using VirtualBox

Sun Microsystems should rename its free, open-source virtualization utility VersatileBox. Not only does it run on Windows, Linux, Mac, and Sun's OpenSolaris, but it also supports an even wider array of guest OSs, including just about any version of Windows.

Let's say you want to start learning to use some Linux tools and applications without dual-booting or repartitioning. Download the Windows version of VirtualBox from Sun's site, and install it. Launch it and click on New to create a new virtual machine.

Click on Next to start the installation process, enter a name for your virtual machine in the dialog box that follows, select an operating system type from the OS Type list, and click Next. Click Next again to accept the default base memory size for your virtual machine (or adjust the slider up or down), and then click Next. Because Linux runs well with minimal system resources, you really needn't allot more than 128MB of RAM to the virtual machine in most cases.

Click New to create and size a virtual hard-disk file; I recommend choosing the dynamically sized option, which will allow the virtual hard-drive size to expand as you fill it with data. Click Finish to create the virtual disk, and then select Next and Finish to complete the virtual-machine creation process.

Now, select your new virtual machine in the Sun xVM VirtualBox console, insert the Linux boot media, and click on Start to begin the boot and installation process. Once everything is installed, launch the virtual OS by selecting it in the Sun xVM VirtualBox window and clicking Start.

Like Virtual PC 2007, VirtualBox runs your guest OS in a window, and grabs the mouse pointer automatically once you click inside it. To release the pointer to the host OS, press the right-hand Ctrl key. To enter full-screen mode, choose Machine, Fullscreen Mode, or press the right-hand Ctrl key and the F key at the same time. To escape full-screen mode, press that key combo again.

Scenario 3: Using Ready-to-Run VMware Appliances With WMware Player

So far we've made the process of installing and configuring a guest operating system using a virtualization utility look easy. But getting a more complicated desktop or server OS working in a virtual machine can be more frustrating, particularly if you're not yet familiar with all of the OS's configuration options. What if you could just plug one in, boom, and see what it looks like?

VMware makes one of the leading free virtualization programs, VMware Server 2.0. For a brief tutorial on how to install VMware Server under Windows, see "Run a 'Guest' OS on Your PC" in the article "12 Great Do-It-Yourself PC Projects."

You don't have to go through all those steps to take an operating system or server application out for a spin, however. VMware's Player allows you to run preinstalled and preconfigured OSs and other software "appliances" as if they were movies or PowerPoint presentations. Player doesn't allow you to make changes to the virtual machine's configuration, but using it is a great way to assess a particular application's features quickly.

VMware hosts hundreds of these applications on its Virtual Appliance Marketplace, ranging in size from a few megabytes (for some of the smaller Linux distributions) to several gigabytes. Though Linux distributions abound--a VMware appliance is a great way to sample a prerelease version of your favorite distro, for example, without giving it free rein over your PC--the majority of appliances are open-source server-based applications, including network backup utilities, content management systems, network security and traffic analyzers, mail servers and spam filters, firewalls, PBX and VOIP servers, and SAN and NAS servers.

To run an appliance, first download and install VMware Player, and then download the virtual appliance you'd like to run (I chose a recent version of the OpenBSD Unix OS). VMware Player's interface offers options for both downloading and launching appliances. Exiting the player saves the appliance's state by default, but there are very few other options. Press Ctrl-G to allow the appliance to capture keyboard and mouse input, and Ctrl-Alt to release input to the host OS.

Scott Spanbauer is a contributing editor for PC World.

This story, "Get started with virtual machines" was originally published by PCWorld.

ITWorld DealPost: The best in tech deals and discounts.
Shop Tech Products at Amazon