Wednesday, January 23, 2008

Full virtualization using XEN

Virtualization
--------------

Virtualization is a technique of dividing a single server into several Virtual Servers, according to hardware and/or software, CPU Time/Process scheduling and memory allocation. Users can install and use their own Operating Systems simultaneously on these virtual servers.
Simply put, it is a server that runs different guest Operating Systems like RedHat Linux, FreeBSD, Debian, Microsoft Windows XP...etc at the same time, controlled by the Host Operating system. Users feel they are using their individual servers with the Operating System they wish to use.

Host OS - The base operating system which controls and co-ordinates the Virtual Servers
Guest OS - The Operating System installed on a Virtual Server


Types of Virtualization

The most commonly using virtualization techniques are;

1. Operating system-level virtualization

This is the simple and most popular virtualization technique. In this method, the virtualization is performed based on a single host operating system. Only the same instance of the host Operating System can be used on the virtual Servers as guest Operating Systems.

Examples : OpenVZ, Linux-VServer

2. Paravirtualization

This technique is somewhat similar to OS level Virtualization, except it is possible to use different guest Operating Systems like Microsoft XP, RedHat Linux, SUSE...etc on the virtual servers. This requires customized versions of Operating systems as guest operating systems. i.e, we can't use the currently available XP, FC6...etc on these virtual servers, but the specially designed versions of these operating systems.

Many OS vendors have started selling their modified versions to perform Paravirtualization.

Examples : XEN, UML


hypervisor - The hypervisor is an application (eg. Kernel, Host OS) that runs between the server hardware and the guest operating systems. In the case of XEN, a specially designed Linux kernel is the hypervisor.

3. Full virtualization

This is the ideal virtualization technique in which any Operating system is used as the host OS and guest OSs. i.e, we can use unmodified versions of OSs on the virtual servers.

Examples : XEN, Vmware, z/VM


Full virtualization using XEN

Actually XEN lies between paravirtualization and full virtualization. XEN integrates its hypervisor on a linux kernal, so that we have to compile and run this modified kernel on the server on which we wish to perform the virtualization. XEN also supports virtual servers management though graphical interfaces. Therefore it is better to install a full version of Linux on the server first, then compile xen-linux kernel, reboot the server using the xen-linux kernel to create and manage servers. In this case, we can create and manage virtual servers through console and/or GUI oriented applications.


Implementing Full Virtualization using XEN (Simplified Steps)


  1. Requirements

  2. CPU support

  3. Installing XEN

  4. Enabling XEN Kernel

  5. Installing Windows 2003 on top of a Virtual Machine

  6. Installing Linux based OSs on top of a Virtual Machine


Requirements

The requirement of a XEN Fully Vitualized server are as follows;


  1. A server installed with working Fedora 7 Operating System

  2. Application builders like gcc v3.2.x binutils, GNU make

  3. 1 GB Memory (Recommending 256 M for each virtual servers) 40 GB HDD

  4. A VT enabled Intel system or AMD-V enabled AMD system (For Full Vitualization)

  5. CDROMs of Guest Operating Systems (Linux OSs or Windows OSs like 2003/XP/Vista)


CPU Support

Make sure that the CPU supports Full virtualization over XEN.


  1. For INTEL Systems, it should have the 'vmx' support. To check, use the following command;

    # grep vmx /proc/cpuinfo


  2. For AMD systems, it should have 'svm' support. To check, use the following command;

    # grep svm /proc/cpuinfo


    If these commands return nothing, then check whether the setting related to 'Virtualization' has enabled on the BIOS (it is turned OFF by default). If the BIOS is not enabled for virtualization, then it may be necessary to upgrade the BIOS.


Installing XEN

First, check for a XEN enabled kernel on the Host OS. Installation of a XEN kernel on Fedora 7 is quite simple using the 'yum' command as follows;

# yum install kernel-xen xen virt-manager



This will install,

  1. XEN enabled kernel for both Host and Guest OSs

  2. All required packages and their dependencies

  3. Hypervisor for controlling Guest OSs

  4. XEN packages for interacting with the Hypervisor


Enabling XEN Kernel


  1. Edit the file '/boot/grub/grub.conf' and set the default kernel to 'kernel-xen'

  2. Restart the server

  3. Type the command 'uname -r' and make sure that the running kernel is 'kernel-xen'



Installing Windows 2003 on top of a Virtual Machine


Not so long ago, installing any OS (whether it is Linux or Windows) on top of XEN was quite a nightmare for system administrators. Now Fedora 7 provides a way to install Guest OSs in a few mouse clicks. Here is how to do it.


  1. Log into Fedora 7 (Host OS) in X session

  2. Goto Application menu and select 'Virtual Machine Manager' from 'System Tools'

  3. This will show the wizard to cerate/manage Virtual Machines

  4. Select the 'New Machine' option from the 'File menu'

  5. Type a name for the new node, say 'Windows2003' (make sure there are no spaces on the node name), and click on the 'Forward button'.

  6. On the next window select 'Full Virtualization' and click on the 'Forward button'.

  7. Now locate the installation media, you can either use a CD-ROM or use an ISO image

  8. Also select the type of Guest OS as 'Windows 2003'

  9. Assign a storage space for the Virtual Machine

  10. Now select 'default virtual network' and click on the 'Forward button'.

  11. Now allocate memory and CPU for the new Virtual Machine (A minimum of 250 M of RAM and 1 VCPU)

  12. Now the installation of Windows 2003 oven XEN will begin

  13. Once the installation is completed, we can start using the Windows 2003 installed Virtual Machine.


Installing Linux based OSs on top of a Virtual Machine

Use the same steps described in the previous section, using proper CD-ROM or ISO image.


Comments

If you wish to create Virtual Machines using a bash shell, use the following command.

# /usr/sbin/virt-install


This method will not allow you to directly install the OS from a CD_ROM or from an ISO image, but it can from NFS, FTP, and HTTP locations. A detailed procedure for doing this can be found at xensource.com

No comments: