VMware and Xen are the top dogs of the virtualization world, but they are not your only choices. Another worthy contender is VirtualBox, which has been called "the best virtualization program you've never heard of." At the least it's one of the easiest to use. We're going to compare the three, and then install and run VirtualBox.
VMware has been around for a long time, and the workstation edition is an old favorite for cross-platform developers. The enterprise editions do more than let you turn a single server into a server farm; they also do resource and storage allocation, and some fancy network management tricks. It's not just a hypervisor; it's a Solution. VMware lets you use either Linux or Windows as the host operating system, except for the ESX and ESXi editions. These are Type 1 hypervisors, which means they run between the bare metal and the guest operating systems, which can be pretty much whatever you want. Hypervisors that require a host operating system, like VMware Workstation and Server, are Type 2 hypervisors. VMware supports both Linux and Windows as host operating systems.
Recent Articles» Scalent Scales Virtualization Management to New Heights
» Virtually Speaking: Big Guns Go Virtual
» ManageIQ Extends Enterprise VM Management
Xen is probably the most-hyped virtualizer, although the hype didn't last long: You have to go back a couple of years to get the full benefit. It is a Type 1 hypervisor, with a twist it requires the guest operating systems to have modified kernels so they know that they are running in a virtualized environment. Xen calls this paravirtualization. Xen 3.0 can run unmodified guests, including Windows, if the system CPU supports x86 virtualization. These days many CPUs have this; on Intel it's called Intel VT (virtualization technology), and AMD calls it AMD-V (you can guess what the V stands for.) Linux will tell you if yours has it:
$ egrep '(vmx|svm)' /proc/cpuinfo
vmx is Intel, and svm is AMD.
"Unmodified guests" has some limitations. You might be able to able to get any random guest OS running after a fashion, but the reality is the virtualizer needs various optimizations for the different operating systems, so a limited number are well-supported.
VMware is closed-source, although it has the free Server and Desktop editions. Xen is now owned by Citrix, and has both a free open source edition and paid commercial versions. The open source edition is community-supported and has fewer features than the paid versions.
VirtualBox was developed by innoTek, which was purchased by Sun in February 2008. Originally VirtualBox was closed-source; then in 2007 it was released under GPL2. Now there are two editions, VirtualBox and VirtualBox OSE (open-source edition). OSE is missing a few features found in the full version, the most notable one being USB support. This is explained thusly:
It is functionally equivalent to the full VirtualBox package, except for a few features that primarily target enterprise customers.
Doesn't everyone need USB? If you don't mind using a closed-source binary, you may use the full version free of cost for personal use or evaluation. OSE is included in some distributions, such as Debian and OpenSUSE. The download page has binary packages and instructions.
VirtualBox is a Type 2 hypervisor, so it needs a host operating system, which can be Linux, Mac OS X, Open Solaris, or Windows, both 32-bit and 64-bit. This table shows supported guest operating systems. If you want to run OS/2 or DOS, you don't even need supported hardware-VirtualBox takes care of it.
Creating a Virtual Machine
After installation, add yourself to the vboxusers group, then log out and log back in. You should find a program launcher in your System menu, or enter the virtualbox command in a terminal. Up pops a nice graphical control panel with a single option activated, New. Go ahead click it. You get a wizard that walks you through creating a new virtual machine. Keep in mind that memory allocation is additive each running virtual machine needs its own allocation of RAM, so you're dividing up whatever you have. For example, if you install four guest OSes that each require 500 MB of RAM, and you have only a gigabyte, then you can only run your host system plus one virtual machine at a time.
You'll have to create a new virtual hard disk. You can either create a dynamic disk or fixed-size. The dynamic virtual hard disk uses the minimum disk space necessary, and expands as needed to a maximum limit. A fixed-size virtual hard disk is always the same size. You get a bit faster performance with a fixed-size virtual image. This will be created in your home directory, unless you specify a different location.
Installing a Guest OS
Well that was fun and easy, but all you have is an empty virtual machine. Now it's time to install a guest OS. You'll need complete installation media because a network installation isn't going to work.
First make sure VirtualBox has correctly recognized your CD/DVD drive. Mine didn't. The kernel name is /dev/hdd, but VirtualBox insisted that it is /dev/cdrom. Well it ain't so. You can find the correct kernel name for your drive with dmesg:
$ dmesg | grep hd $ hdd: ATAPI 48X DVD-ROM DVD-R-RAM CD-R/RW drive, 2048kB Cache
The fix is to edit the configuration file for your new virtual machine, which on my system is/home/carla/.VirtualBox/Machines/debian1/debian1.xml. Look for this section (no spaces):
< DVDDrive passthrough="true"> < HostDrive src="/dev/hdd"/> < /DVDDrive>
Just change the HostDrive src line to the correct value.
Stick your installation CD/DVD in the drive, start up VirtualBox, and then start your new VM (simply click the Start button). If you click the Settings button for your new VM it may complain about not being able to detect the CD/DVDROM. Ignore it; it doesn't know what it's talking about.
First you'll get a message telling you how the VM auto-captures the keyboard and mouse, and how to uncapture them if necessary. Make that go away, and then you'll see an InnoTek logo. You can hit F12 to select the boot device, but it should boot your installation disk automatically. From here it's an ordinary installation. When you're finished, hitting the Start button will boot your new VM.
Part 2 learn how to make snapshots, manage our VMs, and use Guest Additions for better performance. You can get a head start with the Virtual Box user manual, and be sure to check the FAQ for various issues regarding using Linux as the host OS.
This article was originally published on Enterprise Networking Planet.