Introduction
This page describes how AlexisHuxley is using KVM on Debian testing (as it was on 18/10/2008).
Procedure
Verify your CPU supports hardware virtualisation with:
grep flags /proc/cpuinfo
and locate the 'vmx' (Intel) or 'svm' (AMD) flag.Add yourself to the 'kvm' group so that you can read/write /dev/kvm with the command:
adduser <your-login> kvm
and log out and log in again. You can verify you are now in the group with the id command.
- Install the following packages and their prerequisites:
- kvm
- uml-utilities (needed only for tunctl)
- bridge-utils
Run visudo and add the following lines:
<your-login> ALL=NOPASSWD : /usr/sbin/tunctl, /usr/sbin/brctl, /sbin/ip
Download kvm-wrapper, make it executable and save it somewhere in your $PATH. (Note that this script does not secure the qemu monitor port!)
Create a hard-disk image with something like:
kvm-img create -f qcow2 <vm-hostname>.img 10G
where <vm-hostname> is the name of the virtual machine you want to create.
Create <vm-hostname>.conf containing:
KVM_HOSTNAME="<vm-hostname>" KVM_CWD="<dir-where-disk-image-is>" KVM_CTRLPORT="5555" KVM_OPTS="-hda <vm-hostname> -vnc :0"
You can change the KVM_OPTS to suit your own requirements. E.g: Here is AlexisHuxley's ~/kvm-stuff/fusilli.conf:
KVM_HOSTNAME="fusilli" KVM_MACADDR="de:ad:be:ef:f3:b5" KVM_CWD="/home/alexis/kvm-experiments" KVM_CTRLPORT="5555" KVM_OPTS="-hda fusilli.img -hdb fusilli-2.img -vnc :0"
Run:
kvm-wrapper <path-to-the-vm-hostname>.conf
Verify that kvm is using hardware virtualisation by pressing <CTRL-ALT-2> (not <CTRL-ALT-F2>) and running:
info kvm
(You can press <CTRL-ALT-1> to get back to the virtual machine's console).
See also
Computing (other software by AlexisHuxley)
