This Blog is intended to collect information of my various Intrests,pen my opinion on the information gathered and not intended to educate any one of the information posted,but are most welcome to share there view on them
Wednesday, July 28, 2010
Installing Xen on CentOS 5.0
Xen lets you create secondary operating systems, called virtual machines or domus, under the primary operating system (dom0).Using Xen we can separate applications in different virtual machines that are completely independent of one another, (eg virtual machines for mail server for a high-traffic website, one for DNS, etc.) but always the same hardware.This saves money, and most importantly, it is safer.If the DNS server virtual machine is violated by any malicious user, does not affect other virtual machines, it is also possible to move them from one server to another.
I will use CentOS 5.0 (i386) for Both the host OS (dom0) and the guest OS (domU).
We will use CentOS 5.0 (i386) for both the main machine (dom0) and virtual (domU)
1 Preliminary Note
We use the following partitions on the host machine with Centos 5.0 (dom0):
/ Boot 150 MB (ext3)
/ 3GB (ext3)
/ Vm the rest of the disk (ext3)
Create the virtual machines in the / vm, you can use some other directory that contains the remaining space and not have to create a partition for this.
to see if Xen has already begun.This should show something like Domain-0 (dom0):
[Root @ server1 ~] # xm list Name ID Mem (MiB) vcpus State Time (s) Domain-0 0 350 1 r ----- 94.4 [Root @ server1 ~] #
3 Creating the virtual machine
Center includes a good toolmaker called virt-install, where we can create Xen virtual machines.To get started, simply run:
The tool does a few questions before creating the virtual machine.The name of the virtual machine called vm01, with 256 of RAM and disk size of 4GB, this record will be saved in the file / vm/vm01.img:
What is the name of your virtual machine?<- Vm01 How much RAM should be Allocated (in megabytes)?<- 256 What would you like to use as the disk (path)?<- / Vm/vm01.img How large would you like the disk (/ vm/vm01.img) to be (in gigabytes)?<- 4 Would you like to enable graphics support?(Yes or no) <- no What is the install location?<- Http://wftp.tu-chemnitz.de/pub/linux/centos/5.0/os/i386
The graphic support question refers to the installer, not the virtual machine.You can start a graphical installer, but it is necessary to connect via VNC.In this case we choose the installer in text mode.
We specify a mirror close to where the installer can download the files needed for the installation of Centos 5.0 on the virtual machine, can also be through an NFS server only works with Red Hat based distributions:
To start session again in the virtual machine, or also used an ssh client to connect
To view the list of running virtual machines, typing:
The output should display like this:
[Root @ server1 xen] # xm list Name ID Mem (MiB) vcpus State Time (s) Domain-0 0 259 1 r ----- 1906.6 vm01 3255 1 ------ 137.9 [Root @ server1 xen] #
To turn vm01, run:
xm shutdown vm01
To restart it, execute:
xm create / etc/xen/vm01
If you want vm01 virtual machine starts automatically when you boot the system, is typed:
ln-s / etc/xen/vm01 / etc / xen / auto
Here are the most important Xen commands:
xm create-c / path / to / config - Starts the virtual machine xm shutdown - Stops the virtual machine.xm destroy - Stops the virtual machine abruptly.Similar to press the power buttonxm list - List all running systems
xm console - Starts the virtual machine sessionxm help - Displays help for this command