Setting up a Debian-based KVM guests with virtio-based disk and network on CentOS 5.5 hosts


Sometimes it's not possible to use Debian as the host operating system in virtualization. This HOWTO describes how to setup Debian-based VMs (guests) on a CentOS 5.5 which has KVM virtualization enabled. If you are building a Debian-based host, please refer to this article instead.

Installing the Debian guest

First, on host, fetch the Debian netinstall .iso file, then install the Debian guest using virt-install. The command-line is similar to this:

virt-install --accelerate --hvm --connect qemu:///system --cdrom debian-505-amd64-netinst.iso --name Debian-5-amd64 --ram 256 --disk path=/var/lib/libvirt/images/debian-5-amd64.img,size=3 --vnc

The --vnc allows you to connect to the VM console using a VNC client. If you got several VMs running on CentOS simultaneously, their VNC servers are listening on ports 5901, 5902, 5903 and so forth. Connect to the VNC server and complete the install as usual and reboot the VM.

Editing grub configuration

On guests with grub 1 (e.g. Debian Lenny), you need to edit grub configuration:

Setting up virtualized i/o on network and block devices

By default the network and block device performance is not especially good, as an emulation layer is being used. Performance can be increased by using virtualized network and block device i/o.

If the guest kernel does not have the virtio kernel modules built-in, add them to initrd by editing /etc/initramfs-tools/modules. First add these lines to the file:


Then run update-initramfs -u. This takes care of the kernel side of things.

Next, on the host OS issue virsh edit <guestname> and enable virtio guest configuration as described here. Then just reboot the Debian VM and you're done!