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.
Also, the host system should have LVM setup and have plenty of free space in its volume group, so that Cloudmin can create VM disk images as logical volumes.
Cloudmin versions 8.3 and above will offer to automatically setup a Debian, Ubuntu, CentOS or Redhat system as a KVM host when you attempt to add it on the Xen Host Systems page. This includes installing the KVM command and tools, and creating a bridge if necessary. Only if this fails should you follow the manual installation steps below.
Setup Bridge Network Device
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
This changes your system from using eth0 for it's primary network interface, to br0, a bridge device, You will want to make a backup of your current network configuration before making these changes. It is also highly recommended to have console access to your server when the changes are being made. If something goes wrong network access can be lost.
- Go to Webmin -> Networking -> Network Configuration -> Network Interfaces, and select the ** Activated at Boot** tab.
- Click on
eth0and change the IPv4 address to No address configured. Remember the current IP address and netmask, as they will be needed in the next step. Click the Save button.
- Click Add a new bridge, and fill in the IP address and netmask that used to be assigned to
- In the Connect bridge to interface field select
eth0, then click Create.
- Return to the main page of the Network Configuration module, and click on Routing and Gateways . Find the current default IPv4 gateway from the Active configuration tab, and enter it on the Boot time configuration tab with
br0selected as the interface.
- Go back to the main page of the Network Configuration module, and click the Apply Configuration button.
Note that after the above steps. the eth0 device will no longer have an IP address; the br0 device has the IP after bridging is operational.
If you have an IPv6 address, you will want to perform the above steps for the IPv6 address as well.
Package Installation and Setup
- SSH in as root and install the KVM packages. On CentOS/RHEL, that can be done with the command
yum install kvm qemu qemu-img parted. On Ubuntu/Debian, you can use
apt-get install kvm qemu parted
- To enable cgroups support for CPU limits on CentOS/RHEL, run
yum install libcgroup
chkconfig cgconfig on
. On Ubuntu/Debian, run
apt-get install cgroup-bin
update-rc.d cgconfig defaults
- To prevent IP spoofing (optional), you can install EBtables on CentOS with the command
yum install ebtables, and on Ubuntu/Debian with
apt-get install ebtables.
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.