Friday, May 29, 2009

KVM setup

I usually love to start from a brand new OS installation. That way we know what packages we actually need. Follow these instructions for both machines A and B.

1. Confirm your CPU has virtualisation support
egrep 'vmx|svm' /proc/cpuinfo

2. Install kvm packages
yum install kvm kmod-kvm qemu

3. Install appropriate kernel module
modprobe kvm-intel
OR
modprobe kvm-amd

4.Check whether the module is installed or not
lsmod | grep kvm
Also make sure the kvm is present as a device
ls -l /dev/kvm

5.Mount same NFS share at same path (say /mount_point)
mount server:/nfs_share /mount_point

6.Download ISO file for creation on virtual machine
wget -O /mount_point/fedora.iso http://mirror.cc.vt.edu/pub/fedora/linux/releases/10/Fedora/i386/iso/Fedora-10-i386-DVD.iso

7. Create VM image file
qemu-img create fedoraroot.img -f raw 10G

8. I do not know if there is a command line version of qemu. So if your server does not have GUI, you can use following commands
On server
export DISPLAY=your_machine:0.0
On your_machine
xhost +
You can specify server's name after + sign. But I prefer accepting whole world to avoid routing problems.

9. Start VM using
qemu-kvm -m 512 -cdrom fedora.iso -boot d fedoraroot.img

10. Once installation is done, change boot flag to "c"( which is default). You can also remove CD-ROM from VM.
qemu-kvm -m 512 fedoraroot.img

No comments:

Post a Comment