Virtualisation plays a
major role in the cloud and other distributed environment. There are
lot of virtualisation softwares are available. One of the most popular
open source software is XEN and this tutorials explains about how to install xen on rpm based distributions. ( Works well on CentOS, Redhat Enterprise Linux , Fedora ).
The Xen hypervisor, the powerful open
source industry standard for virtualization, offers a powerful,
efficient, and secure feature set for virtualization of x86, x86_64, IA64, ARM, and other CPU architectures. It supports a wide range of guest operating systems including Windows, Linux, Solaris,
and various versions of the BSD operating systems. The Xen.org
community develops and maintains the Xen hypervisor as a free solution
licensed under the GNU General Public License.
Xen powers most public cloud services and many hosting services, such as Amazon Web Services, Rackspace Hosting and Linode. Commercial virtualization products such as Oracle VMand XenServer are built on top of Xen, as well as desktop virtualization solutions such as Qubes OS and XenClient.
From Linux 3.0 onwards, all of the code necessary to run Linux as the
Xen management OS and as a Xen guest, is part of the Linux kernel.
Installation of Xen
Open your terminal and go a head with this command.
#yum groupinstall Virtualisation
This command will install everything you
need and after that open your grub configuration file which is located
in /etc/grub.conf ( if you cant find that grub.conf, use locate command
to find it. ie locate grub.conf )
#vim /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=1
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-92.1.10.el5xen)
root (hd0,0)
kernel /xen.gz-3.3.0
module /vmlinuz-2.6.18-92.1.10.el5xen ro root=/dev/VolGroup00/LogVol00
module /initrd-2.6.18-92.1.10.el5xen.img
title CentOS (2.6.18-92.1.10.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-92.1.10.el5 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-92.1.10.el5.img
Your grub configuration file will be like this. Now reboot your machine.
# reboot
After rebooting, select the xen kernel from the bootlader option * and login into your user account.
Now check out your kernel version by using the command uname
# uname -r
2.6.18-53.1.21.el5xen
So now you are using new xen kernel. Create a directory to install the virtual machine, here i create a
directory in the /vmachine, Of course you can choose your own location
with enough space.
# mkdir /vmachine
If you have guest operating system image
file just copy it to /vmachine directory or else if you have planned to
use remote server then leave it.
Make sure that your SELinux is disable and permissive .
# vim /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
If you had to modify /etc/sysconfig/selinux, please reboot the system else dont reboot.
# reboot
Now run the Xen virtual machine
# xm list
to check if Xen has started. It should list Domain-0 (dom0) [root@linuxinternetworks ~]# xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 867 1 r----- 134.1
[root@linuxinternetworks ~]#
CentOS comes with a nice tool called virt-install with which we can create virtual machines for Xen. To start it, we simply run
#virt-install
What is the name of your virtual machine? vcentos
How much RAM should be allocated (in megabytes)? 512
What would you like to use as the disk (file path)? /vmachine/vmachine1.img
How large would you like the disk (/vm/vm01.img) to be (in gigabytes)? 6
What is the install location? /vmachine/centos.iso
Here i am using image file ( *.iso ) as a source to install the guest operating system. Of Course you can use the url http://www.centos.org/modules/tinycontent/index.php?id=13 . After
we have answered all questions, virt-install starts the normal CentOS
installer in our vmachine1 virtual machine. You already know the
CentOS installer, so it should be no problem for you to finish the
CentOS installation in vmachine1.
After the installation, we stay at
the vmachine1 console. To leave it, type CTRL+] if you are at the
console, or CTRL+5 if you’re using PuTTY. You will then be back at
the dom0 console.
virt-install has created the vmachine1 configuration file /etc/xen/xend-config.sxp
To Run Xen
# xm console vmachine1To get a list of running virtual machines, type
#xm list
The output will look like this
[root@linuxinternetworks ~]# xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 867 1 r----- 168.5
vmachine1 1 512 1 -b---- 197.7
[root@linuxinternetworks ~]#
To shut down vmachine1 : # xm shutdown vmachine1To start vmachine1 : # xm console vmachine1
Some of the xen commands are
xm create -c /path/to/config - Start a virtual machine.
xm shutdown
xm destroy
xm list - List all running systems.
xm console
xm help - List of all commands.
You can also control the xen services by using these commands.
service xend start – To start the service
service xend stop – To stop the service
service xend status – To know about the status of the service
service xend restart – To restart the service
Install XenServer Tools - Linux
Within this tutorial we will cover how to install XenServer Tools to your virtual machines. This applies to CentOS, Debian and Red Hat operating systems.
1.
Open up XenCenter and establish a connection to your XenServer. Here is
an example of a Virtual Machine that is a fresh install but does not
have XenServer Tools setup. You will notice that for "Virtualization State:" the software says "Tools not installed".
2.
Let's get started by simply right-clicking on the name of our Virtual
Machine and clicking "Install XenServer Tools". A warning will come up
stating that, "Any CD or DVD currently in the Virtual Machine's CD drive
will be ejected when xenServer Tools are installed." Click on "Install
ZenServer Tools" to continue unless you are currently using a CD in the
VM. If so, continue this tutorial at a time when the virtual disk drive
is free for use.

3.
You should be sent to the console tab of XenCenter for your Virtual
Machine. You will notice that at the top of the window, below the tabs
that the software is telling you that it has the CD image of
"xs-tools.iso" loaded into the DVD Drive. It also provides you with the
device name within the system.

4.
You can do the following steps via either the console or via an SSH
session to the system. I will perform the installation using SSH. Here
is the output of my session. Remember that the drive's device name is
provided by XenCenter.
$ ssh 10.10.10.3 root@10.17.37.243's password: Last login: Thu Sep 11 12:57:31 2008 from 10.0.80.84 [root@ns0 ~]# cd /mnt [root@ns0 mnt]# ls [root@ns0 mnt]# mkdir xs-tools [root@ns0 mnt]# mount /dev/xvdd /mnt/xs-tools/ mount: block device /dev/xvdd is write-protected, mounting read-only [root@ns0 mnt]# cd /mnt/xs-tools/Linux/ [root@ns0 Linux]# bash install.sh Detected `CentOS release 5.2 (Final)' (centos version 5). The following changes will be made to this Virtual Machine: * packages to be installed/upgraded: - kernel-xen-2.6.18-53.1.13.el5.xs4.1.0.24.x86_64.rpm - xe-guest-utilities-4.1.0-257.x86_64.rpm Continue? [y/n] y Preparing...########################################### [100%] 1:xe-guest-utilities########################################### [100%] Preparing...########################################### [100%] package kernel-xen-2.6.18-92.el5 (which is newer than kernel-xen-2.6.18-53.1.13.el5.xs4.1.0.24) is already installed You should now reboot this Virtual Machine. [root@ns0 Linux]#
If you would like to
simply copy and paste into your shell, the following lines should
perform all of the steps provided that you are assigned the same device
name of /dev/xvdd
mkdir /mnt/xs-tools
mount /dev/xvdd /mnt/xs-tools
cd /mnt/xs-tools/Linux/
bash install.sh
5. The XenServer Tools
installation script does a reasonable job of determining the best way to
install what it needs without much intervention. If everything went
well you should be able to reboot your system from the command line and
when it restarts you can see that XenServer Tools are installed as in
the following image.

6. Now XenCenter will be able to have a bit more control of the operating system within the Virtual Machine and you will also be able to view the previously unavailable counters within the "Performance" tab of XenCenter.

Reference :6. Now XenCenter will be able to have a bit more control of the operating system within the Virtual Machine and you will also be able to view the previously unavailable counters within the "Performance" tab of XenCenter.
www.xen.org
www.centos.org
linuxinternetworks.com
No comments:
Post a Comment