Navigation Menu
 

Background

For those of you who are familiar with virtualization, KVM is a hypervisor which is built into the Linux Kernel. This allows a Linux desktop or server to simulate multiple pieces of hardware, which can then have different operating systems installed. KVM uses the QEMU virtual machine format. QEMU may be familiar to those of you who have used video game emulators. KVM is essentially an advanced CPU emulator built into the Linux kernel.

 

Basics

Installation

To install kvm on Red Hat Enterprise 5.4 or above box use the following. This will install all of the necessary software to use KVM

 

To install kvm on a Fedora use the following. This will install all of the necessary software to use KVM and many utilities

 

Create New Virtual Machines

The fastest and easiest way to use KVM is using virt-manager. From the command line run the following. This program allows you to connect to hypervisors on the local system and can connect to hypervisors on other physical machines using ssh. The virt-manager program has several wizards for creating virtual machines which should be easy to use for anyone familiar with VMware or VirtualBox

 

Convert from VMware Virtual Machines

Another way to create virtual machines is to convert them from VMware images. The directory in the command below includes the VMware .vmx file and all the .vmdk referenced in the .vmx file.

 

Remember: VMware images must first be converted to a single file, pre-allocated disk format. Also the .vmx file must be changed to match the new names of the .vmdk files, or the files must be renamed back to the original name. The vmware-vdiskmanager utility cannot convert disks in place. This must be done on the VMware server before it is moved to the KVM server.

 

Now, it is time to make the newly imported virtual machine recognized by the KVM hypervisor

 

Basic Commands

To list all of the virtual machines which are running on a system use virsh

 

It is a good idea to backup the configuration for any virtual machines that are created in a format that is easy to import later. I normally save this virsh XML to a file in the directory with the virtual machine. This keeps everything together just like a VMware virtual machine.

 

Finally, once a machine is defined and running, it is a good idea to make it autostart on boot if desired. Notice that the files that are created and removed from /etc/libvirt/qemu/autostart

 

Experiment

Once you have backed up the configuration for one of your new virtual machines, try to remove it and re-add it with the virsh define and undefine commands

 

Now look at your list of virtual mchines

 

Redefine the machine using your backed up XML file

 

Now look at your list of virtual mchines again

 

Post a Reply

Your email address will not be published.