1, installation Xen
The code is as follows:
Yum install xen* kernel-xen* virt-manager vnc* xen-lib python-virtinst
Kernel-xen: Can run the Xen Linux core
Xen: The main Xen suite, including configuration files, startup scripts, and some function libraries
function libraries required by the Xen-libs:xen
Python-virtinst: Software for terminal installation
Virt-manager: For graphical interface Management Xen
2, modify grub to let the system boot from the Xen kernel
The code is as follows:
[Root@center ~]# more/etc/grub.conf
< p># grub.conf generated by anaconda
< p>#
< p># note ' You don't have to rerun grub after making changes to this file
< p># notice:you have a/boot partition. This is means that
< p># all kernel and initrd paths are relative to/boot/, eg.
< p># root (hd0,1)
< p># kernel/vmlinuz-version ro root=/dev/sda1
< p># initrd/initrd-version.img
< p> #boot =/DEV/SDA
< p>default=0
< p>timeout=5
< p>splashimage= (hd0,1)/grub/splash.xpm.gz
< P>hiddenmenu
< P>title CentOS (2.6.18-194.32.1.el5xen)
< P>root (hd0,1)
< P>kernel/xen.gz-2.6.18-194.32.1.el5
< P>module/vmlinuz-2.6.18-194.32.1.el5xen ro root=label=/rhgb quiet
< p>module/initrd-2.6.18-194.32.1.el5xen.img
< P>title CentOS (2.6.18-194.EL5)
< P>root (hd0,1)
< P>kernel/vmlinuz-2.6.18-194.el5 ro root=label=/rhgb quiet
< p>initrd/initrd-2.6.18-194.el5.img
3. Reboot the system and confirm that the Xen kernel has been used to boot
The code is as follows:
[Root@center ~]# Uname-ar
< P>linux test1.aa.com 2.6.18-274.17.1.el5xen #1 SMP Tue 18:06:37 EST x86_64 x86_64
4. Adjust the memory used by Xen server (DOM0)
The code is as follows:
Default=0
< p>timeout=5
< p>splashimage= (hd0,0)/grub/splash.xpm.gz
< P>hiddenmenu
< P>title CentOS (2.6.18-238.9.1.el5xen)
< P>root (hd0,0)
< P>kernel/xen.gz-2.6.18-238.9.1.el5 dom0_mem=2097152 (KB unit 2G)
< P>module/vmlinuz-2.6.18-238.9.1.el5xen ro root=label=/
< p>module/initrd-2.6.18-238.9.1.el5xen.img
< P>title CentOS (2.6.18-194.EL5)
< P>root (hd0,0)
< P>kernel/vmlinuz-2.6.18-194.el5 ro root=label=/
< p>initrd/initrd-2.6.18-194.el5.img
The server needs to be restarted after the adjustment is complete.
5, the establishment of local Yum source, easy to install the system
Modify Http.conf:
To increase the listening port:
The code is as follows:
Listen 8000
< P>listen 8001
To increase the virtual host:
The code is as follows:
< P>documentroot/data/os
< p>
< p>options Indexes MultiViews
< P>allowoverride None
< P>order Allow,deny
< P>allow from all
< p>
< p>
Restart HTTPDD:/ETC/INIT.D/HTTPD Reload
6. Create Virtual machines
The code is as follows:
Virt-install-n xen1-r 256-f/home/xen1.img-lhttp://192.168.0.110:8001–network=network:default-s 20–nographics–vnc –vcpus=8
-N: Follow the virtual machine name and configure/etc/xen
-r: The memory size to be allocated later
–vcpus: How many CPUs are allocated
-F: New disk File followed by
–nographics: Do not use a graphical installation
-P: Semi-virtualization
-S: Hard disk space for virtual machines
-L: Back to installation source
7. Clone Virtual Machine
The code is as follows:
< P>virt-clone-o xen1-n Xen2-f/home/xen2.img
< p>
8. Common commands
XM Info View host information
XM top monitors host and domain machine information
XM Create/etc/xen/xen1 Startup
XM shutdown xen1 off
XM reboot Xen1 reboot
XM Pause Xen1 Paused
XM Resume Xen1 Recovery
XM List
XM console xen1 into console
Ctrl +] Exit console
9, optimize
The code is as follows:
[Root@test1 ~]# XM List
Name ID Mem (MiB) Vcpus state time (s)
Domain-0 0 474 1 r-–1222.9
XEN1 255 1-b--81.9
Optimization method: XM vcpu-pin 3 0 1 (the VCPU used by the virtual machine is processed directly by the physical CPU 1)
Confirm that a separate physical CPU has been allocated:
The code is as follows:
XM Vcpu-list 3