Kernel-based Virtual Machine (KVM) is a virtual machine implementation using the operating system's kernel (read more
here). Here are few steps to install kvm in debian:
Server
-
Setup SSH. Read more here.
- Setup bridge-utils package...
apt-get install bridge-utils
... and configure network interface (restart computer so network changes take place):
auto eth0
iface eth0 inet manual
auto br0
iface br0 inet static
address 192.168.10.11
netmask 255.255.255.0
network 192.168.10.0
broadcast 192.168.10.255
gateway 192.168.10.1
bridge_ports eth0
bridge_stp off
# 1.
bridge_fd 0
bridge_maxwait 0
# 2.
#bridge_fd 9
#bridge_hello 2
#bridge_maxage 12
- Install qemu-kvm and libvirt-bin packages:
apt-get -y install qemu-kvm libvirt-bin
- Add a user that will be managing kvm to group libvirt (e.g. user1):
adduser user1 libvirt
Client
-
Setup Password-less ssh login to kvm server. Read more here.
- Install virt-manager package:
apt-get -y install virt-manager
-
If your client is not going to host kvm virtual machines you can disable the following daemons:
update-rc.d ebtables disable
update-rc.d libvirt-bin disable
update-rc.d libvirt-guests disable
update-rc.d lvm2 disable
- Open Virtual Machine Manager from Applications > System Tools.
- In File menu select Add Connection. In dialog that appears ensure method ssh and user that you added on server to group libvirt).
Performance Tuning
- The KVM host can take benefit of KSM by finding and sharing memory blocks between vitual machines (add the following to /etc/rc.local).
echo 100 > /sys/kernel/mm/ksm/sleep_millisecs
echo 1 > /sys/kernel/mm/ksm/run
You can take a look at pages sharing / shared:
cat /sys/kernel/mm/ksm/pages_sharing
cat /sys/kernel/mm/ksm/pages_shared
Another useful thing is to use vhost-net kernel module to boost virtual machine network performance (ensure guest vm uses virtio network device).
echo vhost-net >> /etc/modules
- The KVM linux guest IO performance can be improved by:
- using virtio as disk bus
- setting virtual disk performance options to: cache mode - none, IO mode - native
- using noop IO scheduler for each guest (file /etc/default/grub):
GRUB_CMDLINE_LINUX_DEFAULT="quiet elevator=noop"
Update grub by issuing update-grub command.
No comments :
Post a Comment