1, installation Xen
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
[Root@center ~]# more/etc/grub.conf
# grub.conf generated by Anaconda
#
# so you don't have to rerun grub after making changes to this file
# notice:you have a/boot partition. This is means that
# all kernel and INITRD paths are relative to/boot/, eg.
# root (hd0,1)
# kernel/vmlinuz-version RO root=/dev/sda1
# initrd/initrd-version.img
#boot =/DEV/SDA
Default=0
Timeout=5
Splashimage= (hd0,1)/grub/splash.xpm.gz
Hiddenmenu
Title CentOS (2.6.18-194.32.1.el5xen)
Root (hd0,1)
Kernel/xen.gz-2.6.18-194.32.1.el5
Module/vmlinuz-2.6.18-194.32.1.el5xen ro root=label=/rhgb quiet
Module/initrd-2.6.18-194.32.1.el5xen.img
Title CentOS (2.6.18-194.EL5)
Root (hd0,1)
Kernel/vmlinuz-2.6.18-194.el5 ro root=label=/rhgb quiet
Initrd/initrd-2.6.18-194.el5.img
3. Reboot the system and confirm that the Xen kernel has been used to boot
[Root@center ~]# Uname-ar
Linux test1.aa.com 2.6.18-274.17.1.el5xen #1 SMP Tue to 18:06:37 EST x86_64 x86_64 x86_64
4. Adjust the memory used by Xen server (DOM0)
Default=0
Timeout=5
Splashimage= (hd0,0)/grub/splash.xpm.gz
Hiddenmenu
Title CentOS (2.6.18-238.9.1.el5xen)
Root (hd0,0)
Kernel/xen.gz-2.6.18-238.9.1.el5 dom0_mem=2097152 (KB unit 2G)
Module/vmlinuz-2.6.18-238.9.1.el5xen ro root=label=/
Module/initrd-2.6.18-238.9.1.el5xen.img
Title CentOS (2.6.18-194.EL5)
Root (hd0,0)
Kernel/vmlinuz-2.6.18-194.el5 ro root=label=/
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:
To increase the virtual host:
<virtualhost *:8001>
Documentroot/data/os
<directory "/data/os" >
Options Indexes MultiViews
AllowOverride None
Order Allow,deny
Allow from all
</Directory>
</VirtualHost>
Restart HTTPDD:/ETC/INIT.D/HTTPD Reload
6. Create Virtual machines
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:
Virt-clone-o xen1-n xen2-f/home/xen2.img
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
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:
XM Vcpu-list 3