Thursday, November 05, 2009

Xen Paravirtualization using NFS mounted iso images.

Here I'm going to explain how to install paravirtualization using iso images. Right now paravirtualization not supporting for direct installation of iso images but full virtualization is doing.

We have to mount iso image locally and need to give the iso mount path to virt-install script as NFS mount point.

Here I'll explain whole process in a step by step guide.

1. First you need to create disk image, inside your hard disk. XEN standard image location is "/var/lib/xen/images/", but you can create it in anywhere.
You can use following command to create it. It's 6GB file and block size is 1MB

dd if=/dev/zero of=/var/lib/xen/images/CentOS.img bs=1M count=1 seek=6144

2. Format the image file using ext3 partition type. You can use following command.

mkfs.ext3 /var/lib/xen/images/CentOS.img

3. Mount your iso image locally. (I already placed my iso image /usr/local/VM/CentOS-5.4-i386-bin-DVD.iso)

mkdir /mnt/CentOS
mount -o loop /usr/local/VM/CentOS-5.4-i386-bin-DVD.iso /mnt/CentOS/

4. Edit NFS server 'exports' file, put there "/mnt/CentOS *(ro)" this will mount the partition in read only mode.

vim /etc/exports

if you cat the file, you can see it like this.
[root@nipuna ~]# cat /etc/exports
/mnt/CentOS *(ro)

5. Start NFS server, and run exportfs command, it will show all exported mount points.

/etc/init.d/nfs start

6. Use virt-install command as follows. --ram set the memory size and --vnc will enable the vncviwer. Give --location as nfs mount point with IP.
This Command will prompt the installation, just follow it.

virt-install -p --name=CentOS_01 --ram=1024 --file=/usr/local/VM/images/CentOS.img --vnc --location=nfs:

7. Now you have installed the virtual machine. You can use 'xm list' to view the Virtual machines, virt-manager also a good tool to manage virtual servers.
You can use this command to connect with installed virtual machine.

virt-viewer CentOS_01

No comments:

Post a Comment