Getting started with Linux virtualization

3389

Author: Federico Kereki

With all the Linux distributions available, trying out more than one can be tempting. By installing a virtual environment, you can run several operating systems on your machine, keeping them completely isolated from each other in their own sandboxes. Here’s a look at how get started with three popular virtualization environments: VMware, VirtualBox, and QEMU.

In a virtual ecosystem, a host operating system runs one or more guest virtual machines in a simulated environment. Each guest believes it has all of the host’s physical hardware at its disposal.

You cannot do much virtualization with a small, slow machine, but current-day multi-CPU computers, with 32- or 64-bit architectures and RAM capacity measured in gigabytes, can easily do the job. I used to run virtual machines on a Pentium III with 512KB of RAM, and while the performance was acceptable, it wasn’t exactly astounding. I changed to a dual-core box with 4GB RAM, and now I notice no difference in speed and responsiveness between the host and the guest machines.

VMware

VMware allows you to run multiple x86 (or x86 64-bit) operating systems on a single box. According to VMware, VMware Workstation supports 19 versions of Windows and 26 versions of Linux, and can run as host on both systems. (VMware Fusion runs Windows on a Mac.) VMware is not open source software, but you can try it free for a month; after that, you must either license it (you can buy a license online) or switch to VMware Player, which is a no-cost version that lets you use stored virtual machines but doesn’t let you modify them or create new ones.

Installation is easy. Register for an evaluation copy, download the software, and as root, run rpm -Uvh VMware-workstation-theVersionYouGot.rpm to install both the Workstation and Player programs. To set up the program, run, also as root, vmware-config.pl, which walks you through a series of questions and eventually builds the needed modules. Note that you need the headers appropriate to your kernel; as a rule of thumb, if you’ve installed everything needed to recompile your kernel, you’ll have no problems with this installation.

To create a new virtual machine, start up the Workstation program and click on Create a New Virtual Machine to invoke a wizard for the rest of the configuration. You need to specify what family of operating system you will be installing; your choices include Windows, Linux, Solaris, Novell, MS-DOS, and a few more. You also need to specify the name you want to give your machine, the location for its files, and the size of the virtual disk drive for your new machine. Note that the virtual disk will become a file on your box, but the guest system will think it’s a device on its own. Finally, you need to choose what kind of network access you need. Your choices are “bridged,” which means your virtual machine will connect to your network as an independent box; “NAT,” which means you’ll share your host machine’s IP address; “host only,” which means you’ll connect to an internal network in your server; or “no network.” After this, just pop in an installation CD, start the virtual machine, and you’ll be in business, doing a normal installation process.

The first time you run your new system, you’ll probably want to install the VMware Tools package, which enhances the performance and management of the virtual machine. Navigate to VM -> Install VMware Tools, and a virtual CD will be mounted with an RPM package. Click on it to install it, and you’ll get better graphics response times, support for shared folders (directories on your host that your guest can use), time synchronization between host and guest, and other features.

VirtualBox

VirtualBox is a virtualization program by innotek (which was acquired by Sun earlier this year) with functions similar to VMware’s products. VirtualBox runs under Linux, Mac OS X, Windows, and Solaris, and it supports those same operating systems (plus FreeBSD and OpenBSD) as guest systems. The current version is 1.5.6, with an “upcoming new major version” seemingly in the works.

Originally available under a proprietary license (and free only for private, home use), VirtualBox Open Source Edition (OSE) was released in January 2007 under the GPL. A second version, which is free but not open source, is available only in binary form under the terms of the VirtualBox Personal Use and Evaluation License, which means that it’s free for personal, academic, or evaluation use; otherwise, a license is required. The OSE version lacks some of the enterprise features in the closed source version.

I installed the OSE version directly from openSUSE’s repositories; even if you want to get the latest possible version, it’s usually easier to first install an older version automatically (so all needed dependencies are installed), thus paving the way for a simpler later update. Even after an automatic installation, you will have to do some command-line work on your own, and add all the users that will be allowed to use VirtualBox to the vboxusers group. You will also have to run (as root) /etc/init.d/vboxdrv setup to set up all the required services.

As with VMware, you create a new virtual machine with the help of a wizard. You specify the name of your guest, the operating system type, the RAM size you want it to use, and what disk image to use (you can create it if needed). Then you load the CD with your distribution and start the machine; you will get the installation screens, and eventually you will have a fully working new operating system.

With VirtualBox, you will also benefit if you load the VirtualBox Linux Additions. Go to Devices -> Install Guest Additions, and the proper package will be downloaded and appear as a mounted CD; execute VboxLinuxAdditions.run to finish the installation.

QEMU

QEMU is both a virtualization program and an emulator: it can run programs and operating systems written for a specific CPU on a different machine. When doing virtualization on x86-compatible processors, if you also install an accelerator (KQEMU) you will get a better performance. It is released under the GPL, but some parts fall under the LGPL or BSD licenses. QEMU runs under Linux, Windows, Mac OS X, and Solaris. The easiest way to get it is with your standard package manager; don’t forget to include KQEMU.

Running QEMU usually requires a series of shell commands, but you’re better off installing Qemulator, a graphical interface that’s written in Python and is similar to those of VirtualBox and VMware. Installation is simple: just download the package, unpack it, and launch setup.py. After the installation is done (you will have to answer a few questions, mainly related to paths), you will be able to create or launch virtual machines by running qemulator.

If you’ve tried VMware or VirtualBox, you will feel right at home with the steps needed for creating a new machine. (A small quirk: if you decide to delete a virtual machine, you’ll have to remove the hard disk space on your own; Qemulator doesn’t do that.) You run a machine by clicking the green play button on the upper right corner. No special package or tools exist for graphics and sound performance, so you might notice the machine runs more slowly with multimedia apps.

Conclusion

If you want to explore virtualization, VMware might be the strongest program, but its licensing mode might hamper your experiments. On the other hand, QEMU is fully free, but noticeably slower than the other two programs. VirtualBox strikes a compromise, with its pair of licensing models and performance that matches or surpasses that of VMware.

Category:

  • Desktop Software