Vincent Danen covers the basics of virt-manager, a user interface for managing virtual machines in Linux. KVM and virt-manager will be the default virtualization solution in Red Hat Enterprise Linux 6, so it will be solid and well supported. Here's how to get started.
Virtual Machine Manager (virt-manager) is, simply put, a UI for managing virtual machines. Similar in concept to the GUIs for VMware or VirtualBox, virt-manager is a GUI to handle interfacing with Xen, KVM, or Qemu. Because it uses libvirt to talk to these virtualization products, it is possible that in the future virt-manager will be able to manage other hypervisors and virtual machine programs. It is light-weight and easy to use, and because KVM is "baked" directly into the Linux kernel as of 2.6.20, it makes managing KVM a breeze.
To begin, you need to install KVM and the virt-manager packages:
# yum install virt-manager kvm
# service libvirtd start
Once this is done, start virt-manager by navigating the GNOME menu bar, Applications | System Tools | Virtual Machine Manager. A prompt will come up asking for the root password, and then virt-manager will start.
The window will show a localhost instance of Qemu; this is where you will create your new virtual machine. Before beginning, select the localhost instance and use the Edit menu item, and then select Host Details. This is where you configure virt-manager.
The most important of Host Details is in the Storage tab, as it specifies where virtual images will be saved. By default this is /var/lib/libvirt/images/ which may or may not be a good choice depending on the size of your root (/) or /var partition. Here, / has 5GB free, which only allows for a maximum image size of 5GB, and then leaves nothing for the system, whereas /srv has 32GB free -- a much better choice.
Create a new storage pool and point it to any location you prefer. This can be a directory, partition, iSCSI target, or other remote location. If you do not want to use the predefined default, simply deactivate it after you have created a new storage pool.
Returning to the main virt-manager screen, click the New button to create your first virtual machine. Choose a name for the virtual machine, and select how it will be installed: locally using an ISO or CDROM, over the network using HTTP/NFS/FTP, or using network boot (PXE).
Once you have selected the installation medium and/or directory, you need to tell virt-manager the operating system type. It can handle Linux guests, Solaris, UNIX, Windows, or Other.
If you select Linux, you can also select which version or distribution you plan to install. When this is done, you must provide the CPU and memory settings; KVM can use more than one CPU if you want it to do so, but keep in mind that you should always keep one CPU or core reserved to the system (so if you had four cores, don't let the virtual machine have more than three CPUs).
The next step allows you to enable storage for the virtual machine. Choose the Select Managed Or Other Existing Storage option and then the Browse button. On the next screen, select the New Volume button to create a new storage volume after highlighting which storage pool you wish to use (i.e., if you created a new pool off of the / partition with more space, select it).
Here you can define the size of the pool, the format, and how much to allocate. To create the install image for a Fedora 11 virtual machine, for instance, you might use F11-install.img as the file name and the "raw" format type.
Finally, the next step allows you to select networking options and the virtualization type and architecture. The virtualization type will show at least both KVM and Qemu; KVM is the better choice.
Once this is done, the virtual machine will boot up and you can install the operating system in it.
While virt-manager may be missing some of the features of VMware or VirtualBox, they will likely show up in time as work on virt-manager is ongoing. And as things look now, KVM and virt-manager will be the default virtualization solution in Red Hat Enterprise Linux 6, so it will be solid and well supported.
Get the PDF version of this tip here.
Delivered each Tuesday, TechRepublic's free Linux and Open Source newsletter provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!