Translation(s): es

(!) Discussion


Kernel Based Virtual Machine (KVM)

KVM is a full virtualization solution for Linux on x86 (64-bit included) hardware containing virtualization extensions (Intel VT or AMD-V). It consists of a loadable kernel module, kvm.ko, that provides the core virtualization infrastructure and a processor specific module, kvm-intel.ko or kvm-amd.ko.

Installation

Under Lenny, the Debian package name is 'kvm'. Under Squeeze, it will be 'qemu-kvm'. See README.Debian.gz in the qemu-kvm package for an explanation of the name change.

Using virt-manager

Install kvm with for example the following command, which also installs the Virtual Machine Manager virt-manager.

aptitude install kvm virt-manager

The daemon libvirt-bin is installed as a dependency and will start automatically at boot time and will also load the appropriate kvm modules, kvm-amd or kvm-intel, which are shipped with the Linux kernel Debian package. In order to be able to manage virtual machines as regular user you should put this user into the libvirt group:

adduser <youruser> libvirt

On testing, the group name has changed. To install a VM you must add your user the the kvm group:

adduser <youruser> kvm 

If you do not want or need a GUI and are happy with managing virtual machines from the command line then you can perhaps try the following instead:

aptitude install kvm libvirt-bin

You can then use the virsh(1) command to start and stop virtual machines. For more details see the libvirt page.

Squeeze

You can install KVM like so.. while controlling virtual machines using the kvm command in a similar fashion to QEMU.

aptitude install qemu-kvm

Using virt-manager

Install qemu-kvm with for example the following command, which also installs the Virtual Machine Manager virt-manager.

aptitude install qemu-kvm virt-manager

The daemon libvirt-bin is installed as a dependency and will start automatically at boot time and will also load the appropriate kvm modules, kvm-amd or kvm-intel, which are shipped with the Linux kernel Debian package. In order to be able to manage virtual machines as regular user you should put this user into the libvirt group:

adduser <youruser> libvirt

If you do not want or need a GUI and are happy with managing virtual machines from the command line then you can perhaps try the following instead:

aptitude install qemu-kvm libvirt-bin

You can then use the virsh(1) command to start and stop virtual machines. For more details see the libvirt page.

Troubleshooting

No network bridge available:

virt-manager uses a virtual network for its guests, by default this is routed to 192.168.122.0/24 and you should see this by typing ip route as root.

If this route is not present in the kernel routing table then the guests will fail to connect and you will not be able to complete a guest creation.

Fixing this is simple, open up virt-manager and go to "Edit" -> "Host details" -> "Virtual networks" tab. From there you may create a virtual network of your own or attempt to fix the default one. Usually the problem exists where the default network is not started.

cannot create bridge 'virbr0': File exists:

To solve this probelm you may remove the virbr0 by running:

brctl delbr virbr0

Open virt-manager and go to "Edit" -> "Host details" -> "Virtual networks" start the default network.

You can check the netstatus

virsh net-list --all

Optionally, you can use bridge network BridgeNetworkConnections

See Also