Sunday, October 18, 2009

How To: Virtualize Any OS For Free [How To]

Source: http://feeds.gawker.com/~r/gizmodo/full/~3/nHh04RMMxIg/how-to-virtualize-any-os-for-free

Syncing your Zune in Mac OS X, running Word in Linux, giving Linux a go within Windows 7: just a few of the things you can do with virtual machines. And setting one up isn't just easy—it's free.

The word virtualization conjures images of the dank nerd lairs, populated by lonely network admins, scattered with miles of gray wire, grimy PC towers, processed food packaging and tiny tumbleweeds woven from human hair. It sounds like the domain of the software nerd, the Gentoo jockey, and most importantly, not you. Today, though, virtualization has become mainstream: modern software makes running virtualized operating systems amazingly easy, and undeniably useful.

Intimidating erminology aside, here's what desktop virtualization means today: You can run just about any OS, Mac OS X excluded, inside any other OS. Ubuntu in Mac OS? Sure. Windows 7 within Windows XP? Why not? Windows ME within Snow Leopard? Nobody's going to stop you, I guess! And these aren't patchy, half-assed experiments we're talking about here—these are fully-functioning installations that'll connect to USB peripherals, access the internet, share files with your host OS, and run almost any software, short of 3D games. You can set up as many of these things as you want, and delete them in a matter of seconds. It's pretty great, is what I'm trying to say.

Best of all, virtualization is now something you can try—and stick with&! mdash;fo r free, thanks to software like Sun's VirtualBox. It's a free download on any platform, and it does its job spectacularly. Here's how to get started.

What You'll Need

Free hard drive space: VirtualBox is going to create a simulated hard drive (a hard drive image, to be specific) inside your current OS's file system. In other words, you'll need to have space handy to hold a standard OS install, plus whatever apps you're planning on using on the host system. 10GB is enough to play around with in most cases.

Lots-o-RAM: As efficient as modern virtualization is, running one OS inside another isn't going to be easy on your hardware. The easiest way to ensure good VM performance is to have plenty of RAM, such that both OSes—your host and your guest—can have more than their minimum recommended amount of RAM.

VirtualBox: This is the virtual machine software, or the program in which all of your virtual OSes will run. You may've heard of clients like VMWare or Parallels, but these are either paid or have limited platform support. VirtualBox is a free, cross-platform alternative. Getting it is just a matter of downloading the correct version—there are Windows, Mac and Linux editions—and running an installation wizard.

A guest OS: Installing an OS as a virtual machine is almost exactly like installing an OS natively, albeit slightly easier. In other words, you'll need a full, licensed version of your OS, in whatever form you can get it. Downloaded ISO images will work right out of the box—this is how most Linux distributions will come packaged—while OSes on a CD will work too, including your ! Windows install discs. If applicable, you'll still need to enter license keys—as far as Microsoft is concerned, this is a fresh installation of an OS.

Installing Your Virtual Machine

I've chosen to install Windows 7 within OS X Snow Leopard for this guide, because this will be a common usage scenario, and because the processing of installing an OS in VirtualBox is nearly the same no matter what host/guest combo you're. If you're installing Ubuntu 9.04 within Windows XP, for example, you can still follow along. Anyway, here you go:

Installing Guest Additions


VirtualBox supports so-called "Guest Additions" in some OSes, which are essentially sets of tools and drivers that make the virtualization more seamless. If they're available, you'll want to install them: the guest OS will adjust to your screen resolution properly, your video performance will be smoother (and in Windows XP and Vista, possibly accelerated), filesharing will be simplified, copy and paste will work between OSes, and in some cases, you'll even be able to run individual programs as native windows in your host OS

That's called "Seamless Mode," and if you're running Windows inside Mac OS or Linux, you may as well try it out. It's not quite perfect—the Start Menu stacked atop the Dock is a little awkward—but this way you don't have to switch between entire desktops just to switch from one app to another. It's a cool effect, at the very least.

To in! stall Gu est Additions, click "Install Guest Additions" under the "Machine" menu while running your virtual machine. Guest Additions should appear in your guest OS as an optical disc, which should contain an installer. Run it, then restart your virtual machine. Once Guest Additions are installed, you can access Seamless Mode from the VirtualBox menu, under "Machine."

Shared Directories


Copy and paste will often work between the host and guest OS, but if you're planning on using your guest OS for productivity or downloading any kind of media, a shared folder is the only real solution. In the bottom right corner of a running virtual machine, you should see a small folder icon. Clicking it will bring up a shared folder creation dialog. Select where on your host OS your shared folder should be—it can be an existing directory, like your "Music" folder—and check the box to make it "Permanent." On your guest machine, the shared folder will show up as a VirtualBox shared directory in your local network.

(Note: I'm getting reports that some people running Windows 7 guest machines have trouble finding the network share. You may have to map a network drive manually—just right-click "Computer" anywhere in Windows—the Start Menu works fine—and select "Map Network Drive." Choose whatever drive letter you'd like to give your directory, then enter "\\vboxsvr\myshare" as the folder path, where "myshare" is the name you've given your shared folder in virtualbox.)

Connecting USB Devices


One of the most common reasons for installing a virtual machine is to circumvent some kind of driver incompatibility. VirtualBox recognized most of your computer's inbuilt components, like sound cards, extra storage or webcams, and can use them automatically. For most USB devices, though, you'll need to tell it when to take control.

In most cases, this just means making sure your device isn't in use by your host OS (a flash drive will need to be unmounted, for example), and clicking the small USB plug icon in the bottom right corner of the screen. This will bring up a list of available connected devices; simply click the one you want, and you're good to go.

Odds and Ends

Virtualizing isn't just a good way to get around some kind of nagging compatibility problem, it's a fun way to wile away a few hours experimenting with weird new OSes. Setup is just about the same no matter what you're installing, so there's really no reason not to try some of the more esoteric software out there—anything with an ISO available for download will do. For a taste, try the Haiku Project—a revival of the long-dead BeOS, or see what the hell FreeBSD is.

If you have more tips and tools to share, please drop some links in the comments-your feedback is hugely important to our Saturday How To guides. And if you have any topics you'd like to see covered here, please let me know. Happy virtualizing, folks.