Posted by: kezhong | January 10, 2011

Install Fedora 14 as KVM guest on Logical Volumes of Fedora 14

Before installing Fedora 14, we should enable virtualization through BIOS setting. When I installed Fedora 14 on host machine, I created 9 Logical Volumes, each of them had 200GB. One Logical Volume used for file system of host system, the others for vms.

Install KVM on host
# yum install kvm qemu libvirt python-virtinst

Configure bridge network
Use network service instead of NetworkManager.
Create /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
GATEWAY=192.168.0.1
IPADDR=192.168.0.100
NETMASK=255.255.255.0
ONBOOT=yes

Modify /etc/sysconfig/network-script/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BRIDGE=br0

Download Fedora 14 iso file in the /home/vms directory, rename it to f14.iso, and make sure the root user own it.

Create the configuration file vm1.xml for the first guest in the /etc/libvirt/qemu directory
<domain type=’kvm’>
  <name>vm1</name>
  <uuid>4d78f6cd-e39c-5c28-ecd3-5e32c12cd658</uuid>
  <memory>2097152</memory>
  <currentMemory>2097152</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch=’x86_64′ machine=’pc’>hvm</type>
    <boot dev=’cdrom’/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset=’utc’/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type=’file’ device=’cdrom’>
      <source file=’/home/vms/f14.iso’/>
      <target dev=’hdc’ bus=’ide’/>
      <readonly/>
    </disk>
    <disk type=’block’ device=’disk’>
      <source dev=’/dev/VolGroup00/LogVol01’/>
      <target dev=’vda’ bus=’ide’/>
    </disk>
    <interface type=’bridge’>
      <mac address=’25:30:01:04:a3:62’/>
      <source bridge=’br0’/>
      <model type=’virtio’/>
    </interface>
    <input type=’mouse’ bus=’ps2’/>
    <graphics type=’vnc’ port=’-1′ autoport=’yes’ listen=’192.168.0.100’/>
  </devices>
</domain>

Execute the virsh program, then define vm1.xml, start vm1, vncdisplay vm1 to show IP address and port. Use TigerVNC Viewer to install Fedora 14 as guest. After installed, destroy vm1, modify the vm1.xml file to change “<boot dev=’cdrom’/>” to “<boot dev=’hd’/>”, then define, start again until finish installation.

Reference
Virtualization With KVM On A Fedora 11 Server


Responses

  1. As for CentOS, there is a good link, http://www.cyberciti.biz/faq/centos-rhel-linux-kvm-virtulization-tutorial/


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: