KVM Overview ============
** Personally I always use VirtualBox for desktop virtualization.
You can install KVM during the OS installation, using the “Add/Remove Software” dialog (System > Administration > Add/Remove Software), or manually from the media DVD or a YUM repository.
Whichever way you choose to do the install, the following packages should be included.
qemu-kvm python-virtinst virt-manager virt-top virt-viewer libvirt libvirt-client
When using a YUM repository with groups enabled, you can install the virtualization group.
# yum groupinstall virtualization
Make sure the libvirtd daemon is started and will restart on reboot.
# service libvirtd start # chkconfig libvirtd on
Creating Virtual Machines
If you have used any other desktop virtualization tool, the interface for KVM should be self explanatory. Start the “Virtual Machine Manager” from the menu, or by running “virt-manager” from the command line.
To create a new virtual machine, click the “Create a new virtual machine” button on the toolbar.
Enter the name of the virtual machine and select the type of installation to do based on the location of the installation media. Click the “Forward” button.
Set the appropriate location for the installation media and select the operating system type and version, then click the “Forward” button.
Select the required memory and number of CPUs for the virtual machine, then click the “Forward” button.
Select the required amount of storage space for the VM and decide if you want the space pre-allocated on disk, then click the “Forward” button.
If you are happy with the default settings, click the “Finish” button. If you want to modify the virtual hardware, check the “Customize configuration before install” option before clicking the “Finish” button.
If you chose to customize the configuration before install, you will be presented with the following screen. Make any required changes, then Click the “Begin Installation” button.
The OS installation will proceed on the VM, just like it would on a regular host machine.
The virtual machine manager console will now list the running VM.
Command Line Tools
There are command line tools that perform all the operations shown in the GUI above. To create a new virtual machine, issue the following command and you are prompted for all required information.
# virt-install --prompt
virsh command can be used to start and stop virtual machines.
# # Graceful shutdown of VM # virsh shutdown rhce1 # # Power off VM # virsh destroy rhce1 # # Start/restart VM # virsh start rhce1 # virsh restart rhce1 # # Enable/disable autostart after server reboot. # virsh autostart rhce1 # virsh autostart --disable rhce1 # virsh list --all Id Name State ---------------------------------- 6 rhce1 running #
Virtual machines can be cloned using the GUI or the following command.
# virt-clone --prompt
The configuration files associated with KVM and the virtual machines can be found under the following directories.
Remember, all the commands have associated “man” pages, so you can easily check the available options.
The services associated with KVM are “libvirtd” and “libvirt-guests”. Like other services, their start/stop scripts are present in the “/etc/init.d” directory.
For more information see: