Installing and Using KVM

Revision as of 19:27, 7 March 2011 by Praycrof (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Installing KVM

In order to run KVM, you must have a processor that supports hardware virtualization.

Step 1

Find out if any of the packages needed to run KVM are already installed by running the following command:

rpm -q virt-viewer qemu-kvm virt-manager python-virtinst

Step 2

If any of these four packages are not installed, run the following command in root:

yum groupinstall 'Virtualization'

If your system cannot install these packages, your processor most likely does not support hardware virtualization.



There are two ways to install virtual machines on Fedora using KVM:

Building a Virtual Machine Through the Command Line

Step 1

Download a ISO image of the virtual machine you wish to install OR have a CD-ROM/DVD disk readily available with the guest operating system loaded on it

Step 2

First create a base image using qemu-img on which to install the guest OS. Do this by running a command similar to the following:

qemu-img create -f [FILE FORMAT] [IMAGE FILE NAME] [FILE SIZE]
  • [FILE FORMAT] ---> The most common file format is qcow2. It will make using the base image easier later. Another common file format is raw.
  • [IMAGE FILE NAME] ---> Choose your own file name that reflects the guest operating system (does not need to be specific).
  • [FILE SIZE] ---> Choose a file size to your liking that is large enough to run the guest operating system to be installed. (Suffixes for sizes are K, M, G, T, etc.)

Step 3

Once the base image has been created, you can install a guest operating system in this base image. To do so, run a command similar to the following (WARNING - Only for 64-bit kernels):

qemu-system-x86_64 -hda [BASE IMAGE FILE NAME] -m [MEMORY] -boot d -cdrom [GUEST OS LOCATION]
  • [MEMORY] ---> Choose how much memory you wish to designate to the virtual machine
  • [GUEST OS LOCATION] ---> If an ISO image, enter the file name of the ISO. If loading the guest OS from disk, enter /dev/cdrom

Step 4

This will lead you to install the guest OS on the base image. After completing this process once, you never have to boot this image again.


Building a Virtual Machine Through the GUI Tool

Step 1

Launch Virtual Machine Manager by either selecting in Applications or running virt-manager in the command line.

Step 2

In the VM Manager window, create a new virtual machine by selecting New

Step 3

Follow the installation steps of creating a new VM. Specify the following:

  • Location of the guest operating system file
  • Operating system type and version
  • Memory and CPU Settings
  • Disk Image (either new or existing) and disk image size
  • Architecture

Step 4

Select "Finish," and installation of the VM will begin.