Technology

KVM with RHEL5.4

Installing KVM with RHEL5.4 is pretty easy.  These were some of my notes that I hope you can somewhat follow along with. I have since done it with RHEL5.5 with the same results. Here's how I got my virtual machine up:

1. Install Packages

[cc lang="bash"] yum -y install kvm python-virtinst libvirt libvirt-python virt-manager virt-viewer [/cc] ** Note: I got some of these packages from xCAT's distribution which has some updates. But some of these should still work.

2. Start libvirt

[cc lang="bash"] chkconfig --level 345 libvirtd on service libvirtd start [/cc]

3. Configure Bridge Network

In my set up I want my virtual machines to be able to access the network.  I also want machines on the network to access my virtual machine.  In my setup, eth1 is on the internal network to my cluster.  What I will do is create a bridge with eth1.  I also need to make a few aliases to handle my different networks. /etc/sysconfig/network-scripts/ifcfg-eth1 [cc lang="bash"] # Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper) DEVICE=eth1 HWADDR=00:15:17:85:A8:CD ONBOOT=yes BRIDGE=br0 [/cc] /etc/sysconfig/network-scripts/ifcfg-br0 [cc lang="bash"] DEVICE=br0 BOOTPROTO=static ONBOOT=yes TYPE=Bridge IPADDR=172.20.0.1 NETMASK=255.255.0.0 [/cc] /etc/sysconfig/network-scripts/ifcfg-br0:1 [cc lang="bash"] DEVICE=br0:1 IPADDR=172.29.0.1 NETMASK=255.255.0.0 ONBOOT=yes [/cc] /etc/sysconfig/network-scripts/ifcfg-br0:2 [cc lang="bash"] DEVICE=br0:2 IPADDR=172.30.0.1 NETMASK=255.255.0.0 ONBOOT=yes [/cc]

4. Create Virtual Machine

[cc lang="bash"] virt-install --name xcatmgr --ram 1024 --connect qemu:///system --disk path=/install/libvirt/images/xcat.img,size=10 --vnc --cdrom=/install/isos/RHEL5.4-Server-20090819.0-x86_64-DVD.iso -b br0 --os-variant=rhel5 [/cc]

4.2 Copying Virtual Appliance

I created an xCAT appliance that I wanted to run: [cc lang="bash"] modprobe kvm modprobe kvm.intel service libvirshd restart [/cc] Then import my machine: define /install/xcatapp/xcatmgr.xml (or just copy it to /etc/libvirtd/qemu and restart libvirshd) From there it just booted up, launched virt-viewer and away it went.  I'm doing this on 1TB SATA disks, and the performance is just horrible. Even though I did this all with RHEL5.4, this post was very helpful as well. Now, I also want my nodes to bridge directly to the physical network. [cc lang="bash"] service libvirtd stop ip link set virbr0 down brctl delbr virbr0 create br0 with /etc/sysconfig/network-scripts [/cc] bind it to eth1 then make new net: [cc lang="bash"] brctl setfd vlan1 0 ip addr add dev vlan1 172.20.1.19/16 brctl addif vlan1 eth0 ip addr del dev eth0 172.20.1.19/16 ip link set vlan1 up virt-viewer xcatmgr [/cc] Other good notes: http://wiki.centos.org/HowTos/KVM#head-c02a0b33e7949b0bc3b151ac6e0bdfb91b6bbd1c