Tuesday, July 19, 2011

Xen Virtualization

Share it Please
There are times where we used to configure multiple physical machines to run servers. Now we have many options to configure multiple servers in a single physical machine to provide services. Virtualization provides us the same.

Virtualization allows configuring multiple operating systems in a single Host machine with large processing and memory. Xen is nothing but the Next gENeration Virtualization.

Virtual machine is nothing but a encapsulated Operating System which can run applications as a physical machine. The physical machine contains a program (called Hypervisor) to manage the one or more Virtual machines running (called Domains).

There are 2 types of Virtualizations available

Para Virtualization                                           Full Virtualization
  • Uses modified Kernel                                              Uses OS Kernel(Unmodified)      
  • Cannot run windows                                      Can run windows
  • Guest Know that it is                                     Does not it is Virtual machine Virtual                                                                          Machine and talkTo Hypervisor
In Para Virtualization, when a new Guest Operating system is installed, the kernel of that is modified such that the Guest knows that it is a Virtual machine and it should talk to Hypervisor for any requirements like processing, ram e.t.c. In this article we will see how we can configure Xen virtualization in RHEL5.

Lets start configuring the Virtualization by installing the packages.

Yum install virt-manager* virt-viewer* xen* kernel-xen* libvirt*

Once they are installed. Now it times to make changes to the /etc/grub.conf file.
Since we already had the Operating installed, a default kernel will be installed. Now from the above installation we had installed a new Xen kernel and we need to make this kernel as default to work with virtualization.

A excerpt of the /etc/grub.conf looks like this

#boot=/dev/sda
default=0
timeout=15
#splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console

title Red Hat Enterprise Linux Server (2.6.17-1.2519.4.21.el5xen)
          root (hd0,0)
          kernel /xen.gz-2.6.17-1.2519.4.21.el5 com1=115200,8n1
          module /vmlinuz-2.6.17-1.2519.4.21.el5xen ro root=/dev/VolGroup00/LogVol00
          module /initrd-2.6.17-1.2519.4.21.el5xen.img

We have a default attribute in this file which tell the default kernel to load. As I said there will be default one installed and from the above command we have installed xen-kernal too. So now we need to make sure that the xen-kernal is loaded by default. Check for the kernels in file and set the value to default (by default when xen-kernel is installed, it will be first in list. So we keep ‘1’ to the default).

Once the default value is changed.Reboot the system and then selects the Xen in the boot menu.

Once we are in the system, select virtual-machine manager in the Application ->System Tool -> Virtual Machine Manager

It will look like this 




































We have the Local host and Domain-0 running.Domain-O is a management Virtual Machine and is responsible for interacting with Hypervisor. Guest O.S talks to Domain-O and Domain-O talks to Hypervisor on behalf of Guest O.S.

Para Virtualization supports only 3 types of installation process NFS , HTTP and FTP.So  if we need to install a new O.S , either anyone in the above 3 are to be configured in the Host. So for installing a new RHEL as a Guest we will configure FTP which contains the RHEL DVD that allows us to install a new O.S.

Yum install vsftpd*

We will install the ftp and start the services.

chkconfig vsftpd on
service vsftpd restart

Now copy all the dvd contents to the /var/ftp/pub location(since the ftp service in linux uses this location for upload and download by default).once everything is copied , check the ftp service (a restart of the ftp service may require).

Try in browser ftp://<Ip address> (if you see the contents in pub location and able to download then ftp is working fine).

Lets start configuring a new Guest RHEL using XEN.

Select the Local host and select New.




















Click Forward.

Enter the Name: Guest1 and Forward.





















ParaVirtulized will be selected by default. It you Host supports Fill Virtualization (it will be enabled).Accept it and Click Forward.
 
In the Next Screen, Network Install tree will be selected by default(Since Para Virtualization).
Select the Os Type as Linux.
Select the Os Variant as Red Hat Enterprise Linux 5.





















Click Forward.
In the Next Screen, enter the path for the ftp service in the Installation media URL.




















Click Forward.
In the Next screen, select the Storage type
 























Here we can create a New Partition and use that by Block Device (Partition) or we can select a file from the root location (I used the default).Under the File, you can select the amount of storage we are giving to the new Guest.

Click Forward.

In the Next screen, select the Network Options.




















Select the Shared Physical device to allow network support to the new Guest O.S.
Click Forward.

In the Next screen, select the memory options for the new Guest.





















Click Forward.
Once all are done, the next screen shows us the options we selected



















Click Finish.
It Process for a few seconds and it everything is fine it starts the Installation of new Guest.
You can use alt+tab to move between Guest and host.


Click OK

Click OK
This Screen allows you enter your ip information details.


 












 Click Ok 
Once the information is entered, click OK.
The Next screen will start the Installation of RHEL5 as a Guest.
Once you are done with the installation, you can start the Guest OS by selecting that and right click ->run

More Articles to Come , Happy Coding ..

No comments :

Post a Comment