xen目前还是RHEL/CentOS/OEL5.X支持情况比较好。RHEL6.X就默认不支持了,但是也可以通过安装xen的源进行安装。本文采用OEL5.8 x64进行环境配置。今后将发布一个系列的纯文本配置xen实战配置文章,这里不讨论半虚拟化,完全虚拟化等概念,只讲实战,以此对xen学习做一个总结。

 

xen虚拟化实战系列文章列表

xen虚拟化实战系列(一)之xen虚拟化环境安装
xen虚拟化实战系列(二)之xen虚拟机安装
xen虚拟化实战系列(三)之xen虚拟机复制
xen虚拟化实战系列(四)之xen虚拟机扩展磁盘空间一法
xen虚拟化实战系列(五)之xen虚拟机扩展磁盘空间再一法
xen虚拟化实战系列(六)之xen虚拟机破解密码

xen虚拟化实战系列(七)之xen虚拟机VNC访问配置

xen虚拟化实战系列(八)之xen虚拟机开机自启动配置
xen虚拟化实战系列(九)之xen虚拟机时间配置
xen虚拟化实战系列(十)之xen虚拟机双网卡配置

xen虚拟化实战系列(十一)之xen虚拟机磁盘文件挂载

xen虚拟化实战系列(十二)之xen虚拟机高可用之在线迁移

xen虚拟化实战系列(十三)之xen虚拟机集中管理之convirt

CentOS6.x安装xen4.2虚拟化实践

http://koumm.blog.51cto.com/703525/1536666 

1. 操作系统安装 

采用OEL5.8 X64安装,安装过程中选中图形界面,开发包,开发库,老的软件开发包等,其它都不选。 

OEL下载地址大全: http://koumm.blog.51cto.com/703525/1283801

# uname -a   
Linux oradb 2.6.18-308.el5 #1 SMP Sat Feb 25 12:40:07 EST 2012 x86_64 x86_64 x86_64 GNU/Linux 

 

2. 配置yum源 

说明:通过安装源进行安装是最简单的。 

# cd /etc/yum.repos.d    
# wget http://public-yum.oracle.com/public-yum-el5.repo
# vi public-yum-el5.repo 

#将对应的enable改为1,如下图所示 

Oracle Enterprise linux(OEL)官方yum源配置   
http://koumm.blog.51cto.com/703525/1283867

 

3. yum安装xen 

# yum install kernel-xen xen-libs xen virt-viewer   

Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
el5_latest                                                                                              | 1.4 kB     00:00
el5_latest/primary                                                                                      |  16 MB     01:20
el5_latest                                                                                                         11750/11750
ol5_UEK_base                                                                                            | 1.2 kB     00:00
ol5_UEK_base/primary                                                                                    | 685 kB     00:03
ol5_UEK_base                                                                                                             28/28
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kernel-xen.x86_64 0:2.6.18-348.16.1.0.1.el5 set to be installed
---> Package virt-viewer.x86_64 0:0.0.2-3.el5 set to be updated
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.0.3)(64bit) for package: virt-viewer
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.0.5)(64bit) for package: virt-viewer
--> Processing Dependency: libgtk-vnc-1.0.so.0()(64bit) for package: virt-viewer
--> Processing Dependency: libvirt.so.0()(64bit) for package: virt-viewer
---> Package xen.x86_64 0:3.0.3-142.el5_9.3 set to be updated
--> Processing Dependency: python-virtinst for package: xen
--> Processing Dependency: bridge-utils for package: xen
--> Processing Dependency: libSDL-1.2.so.0()(64bit) for package: xen
---> Package xen-libs.i386 0:3.0.3-142.el5_9.3 set to be updated
--> Processing Dependency: libext4fs.so.2 for package: xen-libs
--> Processing Dependency: liblzma.so.0 for package: xen-libs
---> Package xen-libs.x86_64 0:3.0.3-142.el5_9.3 set to be updated
--> Processing Dependency: libext4fs.so.2()(64bit) for package: xen-libs
--> Running transaction check
---> Package SDL.x86_64 0:1.2.10-9.el5 set to be updated
---> Package bridge-utils.x86_64 0:1.1-3.el5 set to be updated
---> Package e4fsprogs-libs.i386 0:1.41.12-3.el5 set to be updated
---> Package e4fsprogs-libs.x86_64 0:1.41.12-3.el5 set to be updated
---> Package gtk-vnc.x86_64 0:0.3.8-3.el5 set to be updated
---> Package libvirt.x86_64 0:0.8.2-29.0.1.el5_9.1 set to be updated
--> Processing Dependency: cyrus-sasl-md5 for package: libvirt
--> Processing Dependency: ebtables for package: libvirt
---> Package python-virtinst.noarch 0:0.400.3-13.0.1.el5 set to be updated
--> Processing Dependency: libvirt-python >= 0.2.1 for package: python-virtinst
---> Package xz-libs.i386 0:4.999.9-0.3.beta.20091007git.el5 set to be updated
--> Running transaction check
---> Package cyrus-sasl-md5.x86_64 0:2.1.22-7.el5_8.1 set to be updated
--> Processing Dependency: cyrus-sasl-lib = 2.1.22-7.el5_8.1 for package: cyrus-sasl-md5
---> Package ebtables.x86_64 0:2.0.9-5.el5 set to be updated
---> Package libvirt-python.x86_64 0:0.8.2-29.0.1.el5_9.1 set to be updated
--> Running transaction check
--> Processing Dependency: cyrus-sasl-lib = 2.1.22-5.el5_4.3 for package: cyrus-sasl
--> Processing Dependency: cyrus-sasl-lib = 2.1.22-5.el5_4.3 for package: cyrus-sasl-devel
--> Processing Dependency: cyrus-sasl-lib = 2.1.22-5.el5_4.3 for package: cyrus-sasl-devel
--> Processing Dependency: cyrus-sasl-lib = 2.1.22-5.el5_4.3 for package: cyrus-sasl-plain
--> Processing Dependency: cyrus-sasl-lib = 2.1.22-5.el5_4.3 for package: cyrus-sasl-plain
---> Package cyrus-sasl-lib.i386 0:2.1.22-7.el5_8.1 set to be updated
---> Package cyrus-sasl-lib.x86_64 0:2.1.22-7.el5_8.1 set to be updated
--> Running transaction check
---> Package cyrus-sasl.x86_64 0:2.1.22-7.el5_8.1 set to be updated
---> Package cyrus-sasl-devel.i386 0:2.1.22-7.el5_8.1 set to be updated
---> Package cyrus-sasl-devel.x86_64 0:2.1.22-7.el5_8.1 set to be updated
---> Package cyrus-sasl-plain.i386 0:2.1.22-7.el5_8.1 set to be updated
---> Package cyrus-sasl-plain.x86_64 0:2.1.22-7.el5_8.1 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================
Package                       Arch                Version                                       Repository               Size
===============================================================================================================================
Installing:
kernel-xen                    x86_64              2.6.18-348.16.1.0.1.el5                       el5_latest               23 M
virt-viewer                   x86_64              0.0.2-3.el5                                   el5_latest               25 k
xen                           x86_64              3.0.3-142.el5_9.3                             el5_latest              1.9 M
xen-libs                      i386                3.0.3-142.el5_9.3                             el5_latest              177 k
xen-libs                      x86_64              3.0.3-142.el5_9.3                             el5_latest              175 k
Installing for dependencies:
SDL                           x86_64              1.2.10-9.el5                                  el5_latest              213 k
bridge-utils                  x86_64              1.1-3.el5                                     el5_latest               30 k
cyrus-sasl-md5                x86_64              2.1.22-7.el5_8.1                              el5_latest               47 k
e4fsprogs-libs                i386                1.41.12-3.el5                                 el5_latest              108 k
e4fsprogs-libs                x86_64              1.41.12-3.el5                                 el5_latest              105 k
ebtables                      x86_64              2.0.9-5.el5                                   el5_latest              104 k
gtk-vnc                       x86_64              0.3.8-3.el5                                   el5_latest               80 k
libvirt                       x86_64              0.8.2-29.0.1.el5_9.1                          el5_latest              3.2 M
libvirt-python                x86_64              0.8.2-29.0.1.el5_9.1                          el5_latest              239 k
python-virtinst               noarch              0.400.3-13.0.1.el5                            el5_latest              384 k
xz-libs                       i386                4.999.9-0.3.beta.20091007git.el5              el5_latest              100 k
Updating for dependencies:
cyrus-sasl                    x86_64              2.1.22-7.el5_8.1                              el5_latest              1.2 M
cyrus-sasl-devel              i386                2.1.22-7.el5_8.1                              el5_latest              1.4 M
cyrus-sasl-devel              x86_64              2.1.22-7.el5_8.1                              el5_latest              1.4 M
cyrus-sasl-lib                i386                2.1.22-7.el5_8.1                              el5_latest              126 k
cyrus-sasl-lib                x86_64              2.1.22-7.el5_8.1                              el5_latest              130 k
cyrus-sasl-plain              i386                2.1.22-7.el5_8.1                              el5_latest               27 k
cyrus-sasl-plain              x86_64              2.1.22-7.el5_8.1                              el5_latest               27 k
Transaction Summary
===============================================================================================================================
Install      16 Package(s)
Upgrade       7 Package(s)
Total download size: 34 M
Is this ok [y/N]:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating       : cyrus-sasl-lib                                                                                         1/30
Updating       : cyrus-sasl                                                                                             2/30
Installing     : bridge-utils                                                                                           3/30
Installing     : cyrus-sasl-md5                                                                                         4/30
Updating       : cyrus-sasl-plain                                                                                       5/30
Installing     : e4fsprogs-libs                                                                                         6/30
Installing     : xen-libs                                                                                               7/30
Installing     : gtk-vnc                                                                                                8/30
Installing     : ebtables                                                                                               9/30
Installing     : libvirt                                                                                               10/30
Installing     : libvirt-python                                                                                        11/30
Installing     : SDL                                                                                                   12/30
Updating       : cyrus-sasl-lib                                                                                        13/30
Installing     : xz-libs                                                                                               14/30
Updating       : cyrus-sasl-plain                                                                                      15/30
Installing     : e4fsprogs-libs                                                                                        16/30
Installing     : python-virtinst                                                                                       17/30
Installing     : kernel-xen                                                                                            18/30
Installing     : xen                                                                                                   19/30
Installing     : virt-viewer                                                                                           20/30
Installing     : xen-libs                                                                                              21/30
Updating       : cyrus-sasl-devel                                                                                      22/30
Updating       : cyrus-sasl-devel                                                                                      23/30
Cleanup        : cyrus-sasl-plain                                                                                      24/30
Cleanup        : cyrus-sasl                                                                                            25/30
Cleanup        : cyrus-sasl-lib                                                                                        26/30
Cleanup        : cyrus-sasl-devel                                                                                      27/30
Cleanup        : cyrus-sasl-devel                                                                                      28/30
Cleanup        : cyrus-sasl-plain                                                                                      29/30
Cleanup        : cyrus-sasl-lib                                                                                        30/30
Installed:
kernel-xen.x86_64 0:2.6.18-348.16.1.0.1.el5      virt-viewer.x86_64 0:0.0.2-3.el5         xen.x86_64 0:3.0.3-142.el5_9.3
xen-libs.i386 0:3.0.3-142.el5_9.3                xen-libs.x86_64 0:3.0.3-142.el5_9.3
Dependency Installed:
SDL.x86_64 0:1.2.10-9.el5                                        bridge-utils.x86_64 0:1.1-3.el5
cyrus-sasl-md5.x86_64 0:2.1.22-7.el5_8.1                         e4fsprogs-libs.i386 0:1.41.12-3.el5
e4fsprogs-libs.x86_64 0:1.41.12-3.el5                            ebtables.x86_64 0:2.0.9-5.el5
gtk-vnc.x86_64 0:0.3.8-3.el5                                     libvirt.x86_64 0:0.8.2-29.0.1.el5_9.1
libvirt-python.x86_64 0:0.8.2-29.0.1.el5_9.1                     python-virtinst.noarch 0:0.400.3-13.0.1.el5
xz-libs.i386 0:4.999.9-0.3.beta.20091007git.el5
Dependency Updated:
cyrus-sasl.x86_64 0:2.1.22-7.el5_8.1                            cyrus-sasl-devel.i386 0:2.1.22-7.el5_8.1
cyrus-sasl-devel.x86_64 0:2.1.22-7.el5_8.1                      cyrus-sasl-lib.i386 0:2.1.22-7.el5_8.1
cyrus-sasl-lib.x86_64 0:2.1.22-7.el5_8.1                        cyrus-sasl-plain.i386 0:2.1.22-7.el5_8.1
cyrus-sasl-plain.x86_64 0:2.1.22-7.el5_8.1
Complete!

 

4. 修改启动列表,使用运行xen的内核启动系统 

# vi /boot/grub/grub.conf


说明: yum安装后,grub菜单是自动安装好了。 

 

5. reboot 自动进入xen组件的内核。 

# reboot 

 

6. 查看xen启动情况 

默认xen服务开机自启动   
[root@node1 ~]# chkconfig --list |grep xend    
xend            0:off   1:off   2:on    3:on    4:on    5:on    6:off    
xendomains      0:off   1:off   2:off   3:on    4:on    5:on    6:off 

查看xen内核   
[root@node1 ~]# uname -a    
Linux node1 2.6.18-348.16.1.0.1.el5xen #1 SMP Tue Aug 20 13:57:31 PDT 2013 x86_64 x86_64 x86_64 GNU/Linux 

查看xen情况   
[root@node1 ~]# xm list    
Name                                      ID Mem(MiB) VCPUs State   Time(s)    
Domain-0                                   0     1744     1 r-----     32.8 

 

 

到此xen虚拟化环境配置完毕,下面就开始安装虚拟机了。