KVM virtualization is included in the 2.6 Linux kernel, so all recent distributions support it without the need to install a custom kernel. However, it depends on the CPU supporting either the Intel VT or AMD-V virtualization extensions in order to run virtual systems at a reasonable speed.
On some systems, these extensions are disabled in the BIOS by default. Enabling them requires booting the system from the console, entering the BIOS menu and finding the option to turn on virtualization extensions. In some cases the system must then be fully shut down and started up again for this change to take effect.
For KVM instances to access the host system's network, you must setup a network bridge. These instructions assume that your host system has only one network interface, and it is eth0 .
Setting up a Fedora, CentOS or Redhat Host System
To setup a Redhat-based system to host KVM instances, the steps to follow are :
- SSH in as root and install the KVM packages with the command
yum install kvm qemu qemu-img parted - In the
/etc/sysconfig/network-scriptsdirectory, copyifcfg-eth0toifcfg-br0. - Edit the new file and change the
DEVICEline toDEVICE=br0. - Edit the
ifcfg-eth0file, and at the bottom add the lineBRIDGE=br0 - Apply the network settings with the command
service network restart. This should be done at the console, as it will break network access to the host system if anything goes wrong.
Setting up a Debian or Ubuntu Host System
- SSH in as root and install the KVM packages with the command
apt-get install kvm qemu parted - Edit the
/etc/network/interfacesfile and change it to be like :auto eth0 lo br0 iface lo inet loopback iface eth0 inet manual iface br0 inet static address 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255 network 192.168.1.0 gateway 192.168.1.10 bridge_ports eth0 bridge_fd 9 bridge_hello 2 bridge_maxage 12 bridge_stp off
- Apply the network settings with the command
/etc/init.d/networking restartor by rebooting . This should be done at the console, as it will break network access to the host system if anything goes wrong.
Adding a New Host System
- Install Webmin on the host system, if it isn't already.
- Create a directory for storing KVM instance image files, typically
/kvm. This can be located anywhere on the system though. - Add the host system to Cloudmin at Add System -> Add physical system, if it isn't already.
- Go to Host Systems -> KVM Host Systems, click the Register a system for KVM hosting link and select your new host machine.
- Enter the directory you want to use for storing KVM instances, an IP range to allocate to virtual systems, and a DNS domain to add new systems to.
- Click the Register button.
