Creating KVM virtual machines in Red Hat Enterprise Linux 5.4
Red Hat Enterprise Linux (RHEL) 5.4 is the first enterprise Linux distribution that natively supports Kernel-based Virtual Machine (KVM) virtual machines (VMs). Previously, I covered how to set up RHEL as a KVM host
Here I explain how to create KVM VMs in a host.
The easiest way to create a KVM virtual machine is through the virt-manager interface. Start this utility from a console window, and type the virt-manager command from an administrative account.
This interface appears after entering the virt-manager command from an administrative account.(Click image for an enlarged view.)
If the KVM host is live, virt-manager will show the qemu virtualization solution is active on the current host (which should be localhost). To create a VM, select the field. Then, click New. This opens the Create Virtual Machine installation program, and it provides a summary of the required information.
Next, provide a name for the VM. Although it doesn't have to be the same as the VM hostname, it's a good idea for both to share the same title. After entering a name and clicking Forward, virt-manager displays two virtualization methods: paravirtualization and full virtualization. (Note: paravirtualization is not supported in KVM virtualization. Virt-manager shows this option because it is available in the Xen hypervisor). Select full virtualization, and choose KVM as the hypervisor. Then, pick the appropriate hardware platform -- 32-bit or 64-bit -- and click Forward.
Select KVM as the hypervisor. (Click image for an enlarged view.)
Now specify an installation method: either through a network installation server or from a local CD/DVD-drive (the much simpler approach). Then select an operating system. While this is not necessary, this makes it easier to set the configuration parameters later.
Next, configure the VM's storage method. For a storage back end, there are two choices: a physical storage device or the default option of creating a file. For simplicity's sake on this trial run, create a file as the storage back end. When creating the virtual disk, the default of 4 GB is a bit small, so I recommend at least 10 GB.
For an easy installation, choose a file as the storage back end. (Click image for an enlarged view.)
Follow the VM operating system installation procedure to create your first KVM virtual machine in RHEL 5.4. (Click image for an enlarged view.)
In the next three windows, accept the default options. After clicking Finish in the last window, the installation will start automatically. From here, complete the guest operating system installation. Soon after, your first KVM virtual machine will be up and running in RHEL 5.4!
Sander van Vugt is an independent trainer and consultant based in the Netherlands. Van Vugt is an expert in Linux high availability, virtualization and performance and has completed several projects that implement all three. He is also the writer of various Linux-related books, such as
Beginning the Linux Command Line, Beginning Ubuntu Server Administration and
Pro Ubuntu Server Administration.
This was first published in November 2009