免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2434 | 回复: 1
打印 上一主题 下一主题

安装XEN [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-05-13 19:46 |只看该作者 |倒序浏览

环境:CentOS5的Linux操作系统,并且经过Vsftpd+yum server的处理,这个是宿主机。地址是192.168.0.234。

1.安装Xen服务应用程序
===============================================================
Xen的服务器应用程序可以将一台服务器变成Xen服务的宿主机
服务名为:xend
[root@KCentOS ~]# yum install xen*
Dependencies Resolved
=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Installing: (安装主要相关包)
xen                     i386       3.0.3-25.el5     extras            1.8 M
xen-devel               i386       3.0.3-25.el5     base              154 k
xen-libs                i386       3.0.3-25.el5     base               85 k
Installing for dependencies: (安装相关依赖包)
SDL                     i386       1.2.10-8.el5     base              233 k
bridge-utils            i386       1.1-2            base               27 k
libvirt                 i386       0.1.8-15.el5     base              308 k
libvirt-python          i386       0.1.8-15.el5     base               42 k
python-virtinst         noarch     0.99.0-2.el5.centos  base               31 k
Transaction Summary
=============================================================================
Install      8 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)         
Total download size: 2.7 M
Is this ok [y/N]:
Downloading Packages:
(1/8): xen-3.0.3-25.el5.i 100% |=========================| 1.8 MB    00:00     
(2/8): xen-devel-3.0.3-25 100% |=========================| 154 kB    00:00     
(3/8): bridge-utils-1.1-2 100% |=========================|  27 kB    00:00     
(4/8): libvirt-python-0.1 100% |=========================|  42 kB    00:00     
(5/8): python-virtinst-0. 100% |=========================|  31 kB    00:00     
(6/8): libvirt-0.1.8-15.e 100% |=========================| 308 kB    00:00     
(7/8): xen-libs-3.0.3-25. 100% |=========================|  85 kB    00:00     
(8/8): SDL-1.2.10-8.el5.i 100% |=========================| 233 kB    00:00     
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) " from
ftp://192.168.0.234/RPM-GPG-KEY-CentOS-5
Is this ok [y/N]: y
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: xen-libs                     ######################### [1/8]
  Installing: SDL                          ######################### [2/8]
  Installing: bridge-utils                 ######################### [3/8]
  Installing: xen-devel                    ######################### [4/8]
  Installing: libvirt                      ######################### [5/8]
  Installing: xen                          ######################### [6/8]
  Installing: libvirt-python               ######################### [7/8]
  Installing: python-virtinst              ######################### [8/8]
Installed: xen.i386 0:3.0.3-25.el5 xen-devel.i386 0:3.0.3-25.el5 xen-libs.i386 0:3.0.3-25.el5
Dependency Installed: SDL.i386 0:1.2.10-8.el5 bridge-utils.i386 0:1.1-2 libvirt.i386 0:0.1.8-15.el5 libvirt-python.i386 0:0.1.8-15.el5 python-virtinst.noarch
0:0.99.0-2.el5.centos
Complete! (安装完毕)


2.安装Xen的虚拟管理器
===========================================================
Xen的虚拟管理器用来让管理员控制和管理Xen
[root@KCentOS ~]# yum install virt-manager
Dependencies Resolved
=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Installing:  (安装相关包)
virt-manager            i386       0.2.6-7.el5      base              554 k
Installing for dependencies:  (安装依赖关系包)
bitmap-fonts            noarch     0.3-5.1.1        base              906 k
gnome-python2-desktop   i386       2.16.0-1.fc6     base               43 k
gnome-python2-gnomekeyring  i386       2.16.0-1.fc6     base               15 k
libcroco                i386       0.6.1-2.1        base              127 k
libgsf                  i386       1.14.1-6.1       base              116 k
librsvg2                i386       2.16.1-1.el5     base              178 k
vte                     i386       0.14.0-2.el5     base              459 k
Transaction Summary
=============================================================================
Install      8 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)         
Total download size: 2.3 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): libgsf-1.14.1-6.1. 100% |=========================| 116 kB    00:00     
(2/8): gnome-python2-desk 100% |=========================|  43 kB    00:00     
(3/8): vte-0.14.0-2.el5.i 100% |=========================| 459 kB    00:00     
(4/8): bitmap-fonts-0.3-5 100% |=========================| 906 kB    00:00     
(5/8): gnome-python2-gnom 100% |=========================|  15 kB    00:00     
(6/8): librsvg2-2.16.1-1. 100% |=========================| 178 kB    00:00     
(7/8): libcroco-0.6.1-2.1 100% |=========================| 127 kB    00:00     
(8/8): virt-manager-0.2.6 100% |=========================| 554 kB    00:00     
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: libcroco                     ######################### [1/8]
  Installing: bitmap-fonts                 ######################### [2/8]
  Installing: vte                          ######################### [3/8]
  Installing: gnome-python2-desktop        ######################### [4/8]
  Installing: gnome-python2-gnomekeyring   ######################### [5/8]
  Installing: libgsf                       ######################### [6/8]
  Installing: librsvg2                     ######################### [7/8]
  Installing: virt-manager                 ######################### [8/8]
Installed: virt-manager.i386 0:0.2.6-7.el5
Dependency Installed: bitmap-fonts.noarch 0:0.3-5.1.1 gnome-python2-desktop.i386 0:2.16.0-1.fc6 gnome-python2-gnomekeyring.i386 0:2.16.0-1.fc6 libcroco.i386
0:0.6.1-2.1 libgsf.i386 0:1.14.1-6.1 librsvg2.i386 0:2.16.1-1.el5 vte.i386 0:0.14.0-2.el5
Complete!  (安装完毕)


3.安装Xen功能内核
============================================================
加入Xen功能的内核,并通过这带有Xen的内核启动引导系统,使得服务器具有Xen功能。
[root@KCentOS ~]# yum install kernel-xen*
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for kernel-xen-devel to pack into transaction set.
kernel-xen-devel-2.6.18-8 100% |=========================| 781 kB    00:00     
---> Package kernel-xen-devel.i686 0:2.6.18-8.el5 set to be installed
---> Downloading header for kernel-xen to pack into transaction set.
kernel-xen-2.6.18-8.el5.i 100% |=========================| 201 kB    00:00     
---> Package kernel-xen.i686 0:2.6.18-8.el5 set to be installed
--> Running transaction check
Dependencies Resolved
=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Installing:  (安装相关功能包)
kernel-xen              i686       2.6.18-8.el5     base               13 M
kernel-xen-devel        i686       2.6.18-8.el5     base               12 M
Transaction Summary
=============================================================================
Install      2 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)         
Total download size: 26 M
Is this ok [y/N]:
Downloading Packages:
(1/2): kernel-xen-devel-2 100% |=========================|  12 MB    00:01     
(2/2): kernel-xen-2.6.18- 100% |=========================|  13 MB    00:01     
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: kernel-xen                   ######################### [1/2]
  Installing: kernel-xen-devel             ######################### [2/2]
Installed: kernel-xen.i686 0:2.6.18-8.el5 kernel-xen-devel.i686 0:2.6.18-8.el5
Complete!  (安装完毕)



4.配置系统内核文件
=====================================================
[root@KCentOS boot]# ls -lh /boot  (安装好了Xen内核之后,察看/boot目录下的文件)
total 9.7M
-rw-r--r-- 1 root root  61K Mar 16 08:19 config-2.6.18-8.el5
-rw-r--r-- 1 root root  60K Mar 16 09:27 config-2.6.18-8.el5xen
drwxr-xr-x 2 root root 1.0K Aug 20 21:18 grub
-rw------- 1 root root 1.5M Aug 20 18:58 initrd-2.6.18-8.el5.img
-rw------- 1 root root 1.5M Aug 20 21:18 initrd-2.6.18-8.el5xen.img  (带Xen功能的启动镜像文件)
drwx------ 2 root root  12K Aug 20 18:47 lost+found
-rw-r--r-- 1 root root  93K Jan  9  2007 memtest86+-1.65
-rw-r--r-- 1 root root  79K Apr  1 22:49 message
-rw-r--r-- 1 root root  82K Mar 16 08:20 symvers-2.6.18-8.el5.gz
-rw-r--r-- 1 root root  83K Mar 16 09:28 symvers-2.6.18-8.el5xen.gz
-rw-r--r-- 1 root root 865K Mar 16 08:19 System.map-2.6.18-8.el5
-rw-r--r-- 1 root root 848K Mar 16 09:27 System.map-2.6.18-8.el5xen
-rw-r--r-- 1 root root 1.7M Mar 16 08:19 vmlinuz-2.6.18-8.el5
-rw-r--r-- 1 root root 2.0M Mar 16 09:27 vmlinuz-2.6.18-8.el5xen  (带Xen功能的启动内核文件)
-rw-r--r-- 1 root root 269K Mar 16 07:51 xen.gz-2.6.18-8.el5
-rwxr-xr-x 1 root root 595K Mar 16 09:43 xen-syms-2.6.18-8.el5

更改启动内核
[root@KCentOS boot]# vi /boot/grub/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/sda3
#          initrd /initrd-version.img
#boot=/dev/sda
default=0   (这里要改成0)
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-8.el5xen)    (这个就是具有xen功能的系统内核,更改用这个启动项默认启动系统)
        root (hd0,0)
        kernel /xen.gz-2.6.18-8.el5
        module /vmlinuz-2.6.18-8.el5xen ro root=LABEL=/
        module /initrd-2.6.18-8.el5xen.img
title CentOS (2.6.18-8.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-8.el5 ro root=LABEL=/
        initrd /initrd-2.6.18-8.el5.img
"grub/grub.conf" 22L, 715C written

用xen功能内核引导重启
[root@KCentOS boot]# reboot
Broadcast message from root (pts/0) (Mon Aug 20 23:42:47 2007):
The system is going down for reboot NOW!



5.用xen功能内核引导重启
==============================================================
多一条内核启动选项:
CentOS (2.6.18-8.e15xen)  (现在重新启动后,在引导系统启动的界面中,就发现多出来了这个启动项)
CentOS (2.6.16-8.e15)   


6.检查xen功能
==============================================================
虚拟域状况
      虚拟域的概念。在安装好Xen服务的宿主机上,就会有一个Domain-0的零虚拟域,这个是最高的根虚拟域,管理控制虚拟域。然后新建立的虚拟机,各自都会有一个虚拟域,一个虚拟域里承载着一台Xen虚拟机。
[root@KCentOS ~]# xm list  (xm list命令就是列出当前的虚拟域)
Name                                      ID          Mem(MiB)         VCPUs          State          Time(s)
Domain-0 (根虚拟域)             (域ID)     (虚拟机内存)  (虚拟CPU数量)  (当前状态)   (运行时间)      
察看日志路径
[root@KCentOS ~]# ls -lh /var/log/xen
total 8.0K
-rwxr-xr-x 1 root root   36 Aug 20 23:47 xend-debug.log
-rw-r--r-- 1 root root 1.7K Aug 20 23:46 xend.log
察看日志状况
[root@KCentOS ~]# cat /var/log/xen/xend-debug.log
Nothing to flush.
Nothing to flush.

到此,Xen状况正常。


7.指定自己的xen虚拟机的存放路径
==================================================================
Xen虚拟机的方式是以文件而存在的,处了配置文件之外,我们所说的是虚拟机的承载文件,也就虚拟机占用了真实主机的磁盘空间的文件。但是,又因为在Linux这种类Unix系统里,任何东西都是以文件方式存在的,一个镜像文件如:image.img,或者又是一个设备文件如:/dev/sdb5,都是可以用文件的方式存在。所以Xen虚拟机也就变的灵活,它可以是一个占用宿主机磁盘空间的文件(即所谓的以文件方式建立的虚拟机),也可以是一个宿主机某个磁盘分区(即所谓的以磁盘分区方式建立的虚拟机)。了解了这些,就建立起了虚拟机如何占用宿主机的概念了。
[root@KCentOS /]# mkdir /opt/xen  (我这里定义的存放xen存储路径为/opt/xen)
[root@KCentOS /]# cd /opt/xen
[root@KCentOS xen]# mkdir jason1 jason2 jason3  (在/opt/xen/目录下,我又分别建立了3个目录,每个目录里放一个虚拟机)
[root@KCentOS xen]# ls
jason1  jason2  jason3

8.建立虚拟机
==============================================================================
Xen提供了一系列的命令以及一系列的方式可以让用户安装虚拟机,我这里使用的是最简单的方式安装。
首先我进入了/opt/xen/jason1的这个目录,建立第一个虚拟机。
注意,必须要进入指定虚拟机目录才输入以下命令,因为建立的虚拟机默认是在当前目录下的哦。
[root@localhost ~]# virt-install -n jason_vm_2 -r 1024 --vcpus=2 --file=jason_masterdisk.img --file=jason_slavedisk.img --nographics -l
http://221.238.193.210/yum/base/
How large would you like the disk (jason_masterdisk.img) to be (in gigabytes)? 8
How large would you like the disk (jason_slavedisk.img) to be (in gigabytes)? 1

Starting install...

这里我要解释下这个命令:
virt-install  是在当前目录下建立虚拟机的命令
-n            这个虚拟机在宿主机上注册的名字,它将和这个虚拟机分配到的Domain ID进行绑定,并且在/etc/xen/下也有同名的配置文件。
-r             指定分配到这个虚拟机的内存容量,单位默认是MB。
--vcpus     指定分配到这个虚拟机的CPU数量,单位是个。
--file         给与这个虚拟机的.img虚拟磁盘镜像文件。一个文件对应一个虚拟机下的虚拟磁盘空间,这里我设置的--file=jason_masterdisk.img --file=jason_slavedisk.img 表示这个虚拟机将会有两个磁盘,我取名字为masterdisk和slavedisk表示这两个磁盘将作为这个虚拟机的主磁盘和辅磁盘用。另外,当这里参数根在命令时,后面系统会问你要分配每个镜像磁盘大小是多少,我后面分别给了8和1,因为单位给的是GB。
--nographics  没有图形界面的安装。
-l                 指定安装方式,这里只支持FTP/HTTP/NFS三种方式。我这里跟了FTP的安装路径。

接着系统会询问你之前指定的几个磁盘文件大小,单位是G。只要回答数字就可以了
之后会提示Installing...表示已经开始初始化了。

初始化虚拟机,以下是初始虚拟机时的一些信息。
Linux version 2.6.18-8.el5xen (mockbuild@builder4.centos.org) (gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)) #1 SMP Thu Mar 15 21:02:53 EDT 2007
BIOS-provided physical RAM map:
Xen: 0000000000000000 - 0000000020800000 (usable)
0MB HIGHMEM available.
520MB LOWMEM available.
NX (Execute Disable) protection: active
ACPI in unprivileged domain disabled
Built 1 zonelists.  Total pages: 133120
Kernel command line:   method=http://221.238.193.210/yum/base/
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Initializing CPU#0
CPU 0 irqstacks, hard=c071b000 soft=c06fb000
PID hash table entries: 4096 (order: 12, 16384 bytes)
Xen reported: 1596.041 MHz processor.
Console: colour dummy device 80x25
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Software IO TLB disabled
vmalloc area: e1000000-f4ffe000, maxmem 2d7fe000
Memory: 507008k/532480k available (2017k kernel code, 16888k reserved, 824k data, 172k init, 0k highmem)
Checking if this processor honours the WP bit even in supervisor mode... Ok.
Calibrating delay using timer specific routine.. 3992.03 BogoMIPS (lpj=7984071)
Security Framework v1.0.0 initialized
SELinux:  Initializing.
SELinux:  Starting in permissive mode
selinux_register_security:  Registering secondary module capability
Capability LSM initialized as secondary
Mount-cache hash table entries: 512
CPU: L1 I cache: 32K, L1 D cache: 32K
CPU: L2 cache: 4096K
Checking 'hlt' instruction... OK.
SMP alternatives: switching to UP code
CPU 1 irqstacks, hard=c071c000 soft=c06fc000
Brought up 1 CPUs
checking if image is initramfs... it is
Freeing initrd memory: 6485k freed
Grant table initialized
NET: Registered protocol family 16
ACPI Exception (utmutex-0262): AE_BAD_PARAMETER, Thread C0E77AA0 could not acquire Mutex [2] [20060707]
SMP alternatives: switching to SMP code
Initializing CPU#1
migration_cost=23
Brought up 2 CPUs
PCI: setting up Xen PCI frontend stub
ACPI: Interpreter disabled.
Linux Plug and Play Support v0.97 (c) Adam Belay
pnp: PnP ACPI: disabled
xen_mem: Initialising balloon driver.
usbcore: registered new driver usbfs
usbcore: registered new driver hub
PCI: System does not support PCI
PCI: System does not support PCI
NetLabel: Initializing
NetLabel:  domain hash size = 128
NetLabel:  protocols = UNLABELED CIPSOv4
NetLabel:  unlabeled traffic allowed by default
NET: Registered protocol family 2
IP route cache hash table entries: 32768 (order: 5, 131072 bytes)
TCP established hash table entries: 131072 (order: 8, 1048576 bytes)
TCP bind hash table entries: 65536 (order: 7, 524288 bytes)
TCP: Hash tables configured (established 131072 bind 65536)
TCP reno registered
IA-32 Microcode Update Driver: v1.14-xen
audit: initializing netlink socket (disabled)
audit(1187745102.893:1): initialized
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
SELinux:  Registering netfilter hooks
Initializing Cryptographic API
ksign: Installing public key data
Loading keyring
- Added public key EE79A493AEE5EDC9
- User ID: CentOS (Kernel Module GPG key)
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
pci_hotplug: PCI Hot Plug PCI Core version: 0.5
rtc: IRQ 8 is not free.
Non-volatile memory driver v1.2
Linux agpgart interface v0.101 (c) Dave Jones
RAMDISK driver initialized: 16 RAM disks of 16384K size 4096 blocksize
Xen virtual console successfully installed as xvc0
Linux version 2.6.18-8.el5xen (mockbuild@builder4.centos.org) (gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)) #1 SMP Thu Mar 15 21:02:53 EDT 2007
BIOS-provided physical RAM map:
Xen: 0000000000000000 - 0000000020800000 (usable)
0MB HIGHMEM available.
520MB LOWMEM available.
NX (Execute Disable) protection: active
ACPI in unprivileged domain disabled
Built 1 zonelists.  Total pages: 133120
Kernel command line:   method=ftp://221.238.193.214  
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Initializing CPU#0
CPU 0 irqstacks, hard=c071b000 soft=c06fb000
PID hash table entries: 4096 (order: 12, 16384 bytes)
Xen reported: 1596.041 MHz processor.
Console: colour dummy device 80x25
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Software IO TLB disabled
vmalloc area: e1000000-f4ffe000, maxmem 2d7fe000
Memory: 507008k/532480k available (2017k kernel code, 16888k reserved, 824k data, 172k init, 0k highmem)
Checking if this processor honours the WP bit even in supervisor mode... Ok.
Calibrating delay using timer specific routine.. 3992.03 BogoMIPS (lpj=7984071)
Security Framework v1.0.0 initialized
SELinux:  Initializing.
SELinux:  Starting in permissive mode
selinux_register_security:  Registering secondary module capability
Capability LSM initialized as secondary
Mount-cache hash table entries: 512
CPU: L1 I cache: 32K, L1 D cache: 32K
CPU: L2 cache: 4096K
Checking 'hlt' instruction... OK.
SMP alternatives: switching to UP code
CPU 1 irqstacks, hard=c071c000 soft=c06fc000
Brought up 1 CPUs
checking if image is initramfs... it is
Freeing initrd memory: 6485k freed
Grant table initialized
NET: Registered protocol family 16
ACPI Exception (utmutex-0262): AE_BAD_PARAMETER, Thread C0E77AA0 could not acquire Mutex [2] [20060707]
SMP alternatives: switching to SMP code
Initializing CPU#1
migration_cost=23
Brought up 2 CPUs
PCI: setting up Xen PCI frontend stub
ACPI: Interpreter disabled.
Linux Plug and Play Support v0.97 (c) Adam Belay
pnp: PnP ACPI: disabled
xen_mem: Initialising balloon driver.
usbcore: registered new driver usbfs
usbcore: registered new driver hub
PCI: System does not support PCI
PCI: System does not support PCI
NetLabel: Initializing
NetLabel:  domain hash size = 128
NetLabel:  protocols = UNLABELED CIPSOv4
NetLabel:  unlabeled traffic allowed by default
NET: Registered protocol family 2
IP route cache hash table entries: 32768 (order: 5, 131072 bytes)
TCP established hash table entries: 131072 (order: 8, 1048576 bytes)
TCP bind hash table entries: 65536 (order: 7, 524288 bytes)
TCP: Hash tables configured (established 131072 bind 65536)
TCP reno registered
IA-32 Microcode Update Driver: v1.14-xen
audit: initializing netlink socket (disabled)
audit(1187745102.893:1): initialized
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
SELinux:  Registering netfilter hooks
Initializing Cryptographic API
ksign: Installing public key data
Loading keyring
- Added public key EE79A493AEE5EDC9
- User ID: CentOS (Kernel Module GPG key)
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
pci_hotplug: PCI Hot Plug PCI Core version: 0.5
rtc: IRQ 8 is not free.
Non-volatile memory driver v1.2
Linux agpgart interface v0.101 (c) Dave Jones
RAMDISK driver initialized: 16 RAM disks of 16384K size 4096 blocksize
Xen virtual console successfully installed as xvc0
Event-channel device installed.
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
ide-floppy driver 0.99.newide
usbcore: registered new driver hiddev
usbcore: registered new driver usbhid
drivers/usb/input/hid-core.c: v2.6:USB HID core driver
PNP: No PS/2 controller found. Probing ports directly.
i8042.c: No controller found.
mice: PS/2 mouse device common for all mice
md: md driver 0.90.3 MAX_MD_DEVS=256, MD_SB_DISKS=27
md: bitmap version 4.39
TCP bic registered
Initializing IPsec netlink socket
NET: Registered protocol family 1
NET: Registered protocol family 17
Using IPI No-Shortcut mode
XENBUS: Device with no driver: device/vbd/51712
XENBUS: Device with no driver: device/vbd/51728
XENBUS: Device with no driver: device/vif/0
Freeing unused kernel memory: 172k freed
Write protecting the kernel read-only data: 355k
Greetings.
anaconda installer init version 11.1.2.36 starting
mounting /proc filesystem... done
creating /dev filesystem... done
mounting /dev/pts (unix98 pty) filesystem... done
mounting /sys filesystem... done
anaconda installer init version 11.1.2.36 using /dev/xvc0 as console
trying to remount root filesystem read write... done
mounting /tmp as ramfs... done
running install...
running /sbin/loader
G
到此,虚拟机已经初始化好并已经引导安装了。


10.开始安装虚拟机的系统
==================================================================
这里用终端界面复制粘贴过来的,虽然有点乱,但是这里只是示意安装过程而已。
选择安装界面的语言类型
Welcome to CentOS                                                                                                                                             
  +---------+ Choose a Language +---------+                 
  |                                       |                                      | What language would you like to use   |                 
  | during the installation process?      |                                      |                                       |                 
  |       Catalan                ^        |                                      |       Chinese(Simplified)    :        |                    
  |       Chinese(Traditional)   #        |                                      |       Croatian               :        |   
  |       Czech                  :        |                                      |       Danish                 :        |               
  |       Dutch                  :        |                                      |       English                v        |               
  |                                       |                                      |                +----+                 |               
  |                | OK |                 |                                      |                +----+                 |                 
  |                                       |                                      |                                       |               
  +---------------------------------------+                     / be                                          next screen      

配置TCP/IP
Welcome to CentOS                                                                                                                                                                                                                                         +----------------+ Configure TCP/IP +----------------+                         |                                                    |                         |  
  • Enable IPv4 support                            |                         |        (*) Dynamic IP configuration (DHCP)         |                         |        ( ) Manual configuration                    |                         |                                                    |                         |  
  • Enable IPv6 support                            |                         |        (*) Automatic neighbor discovery (RFC 2461) |                         |        ( ) Dynamic IP configuration (DHCP)         |                         |        ( ) Manual configuration                    |                         |                                                    |                         |          +----+                  +------+          |                         |          | OK |                  | Back |          |                         |          +----+                  +------+          |                         |                                                    |                         |                                                    |                         +----------------------------------------------------+                                                                                                                                                                            / be                                          next screen      

    ===========================实在太花乱=========================不再继续粘贴安装系统过程了



    11.检查虚拟机
    ==================================================================
    在我指定的/opt/xen/test1目录下,建立的第一台虚拟机,看看这个目录里的文件以及大小
    [root@localhost test1]# ls -lh
    total 1.2G
    -rwxr-xr-x 1 root root 1.1G Aug 20 12:10 jason_slavedisk.img
    -rwxr-xr-x 1 root root 8.1G Aug 22 09:08 jason_masterdisk.img
    可见,这里就是2个之前安装虚拟机是指定的承载空间镜像文件,在虚拟机里,这两个就是系统的两个磁盘。

    再看看在/etc/xen/路径下关于Xen的配置文件
    [root@localhost xen]# ls -lh /etc/xen
    total 80K
    drwxr-xr-x 2 root root 4.0K Mar 15 12:06 auto
    -rw-r--r-- 1 root root  348 Aug 22 09:11 jason_vm (这里的jason_vm就是之前我建立的jason_vm虚拟机的名字,会有一份同名的配置文件生成在 /etc/xen的目录下)
    -rwxr-xr-x 1 root root  164 Mar 15 12:06 qemu-ifup
    drwxr-xr-x 2 root root 4.0K Aug 17 11:26 scripts
    -rw-r--r-- 1 root root 4.9K Aug 17 12:56 xend-config.sxp
    -rw-r--r-- 1 root root 1.3K Mar 15 12:06 xend-pci-permissive.sxp
    -rw-r--r-- 1 root root 4.1K Mar 15 12:06 xend-pci-quirks.sxp
    -rw-r--r-- 1 root root 5.4K Mar 15 12:06 xmexample1
    -rw-r--r-- 1 root root 6.6K Mar 15 12:06 xmexample2
    -rw-r--r-- 1 root root 7.1K Mar 15 12:06 xmexample.hvm
    -rw-r--r-- 1 root root 5.2K Mar 15 12:06 xmexample.vti
    察看我的虚拟机jason_vm的配置文件内容
    [root@localhost xen]# cat /etc/xen/jason_vm
    # Automatically generated xen config file
    name = "jason_vm"  (虚拟机名)
    memory = "512"  (内存容量)
    disk = [ 'tap:aio:/root/jason_masterdisk.img,xvda,w', 'tap:aio:/root/jason_slavedisk.img,xvdb,w', ]  (虚拟磁盘路径)
    vif = [ 'mac=00:16:3e:25:8b:91, bridge=xenbr1', ]  (虚拟网卡)
    uuid = "c1f0f80a-f827-5e02-2091-a78efea97eed"  (序列号)
    bootloader="/usr/bin/pygrub"  (启动引导器)
    vcpus=2  (虚拟CPU数量)
    on_reboot   = 'restart'
    on_crash    = 'restart'
    察看虚拟机运行状态:
    [root@localhost xen]# xm list
    --------------------------------------------------------------------------
    Name                                      ID Mem(MiB) VCPUs State   Time(s)
    Domain-0                                   0     2513     2 r-----    592.7
    jason_vm                                       7      511     2 -b----      2.0
    test2                                        4      511     2 -b----    635.2
    test3                                        2      511     2 -b----    182.2
    -------------------------------------------------------------------
    这里我们可以看到一个Domain-0,也就是根虚拟域,它的Domain ID永远是0,它就是代表宿主机。
    另外还有名称为jason_vm,test2,test3三个虚拟机,并且可以看到它们的Domain ID分别是7,4,2。
    可以通过xm命令跟上他们的ID或者虚拟机名来操作虚拟机。

    比如我要关闭jason_vm这台虚拟机
    [root@localhost xen]# xm shutdown 7
    格式为:xm shutdown ID 或者 xm shutdown name

    如果要启动一个虚拟机
    格式为:xm create ID 或者 xm create name
    由于一个关闭的虚拟机没有明显的Domain ID。因此经常要使用xm create 虚拟机名 才能启动,如果忘记了虚拟机名,可以到/etc/xen下看看它的配置文件,因为会有同名的配置文件生成在/etc/xen下,那么看到配置文件名就能知道他的虚拟机名称了。所以前期对虚拟机名的规划就比较重要了。
    [root@localhost xen]# xm create jason_vm
    下面是启动虚拟机的一些信息
    Using config file "./jason_vm".
    Going to boot CentOS (2.6.18-8.el5xen)
      kernel: /vmlinuz-2.6.18-8.el5xen
      initrd: /initrd-2.6.18-8.el5xen.img
    Started domain jason_vm

    如果我要进入控制一个虚拟机
    格式为:xm console ID 或者 xm console name
    这样可以得到一个虚拟机的控制台。


    本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/10912/showart_687053.html
  • 论坛徽章:
    0
    2 [报告]
    发表于 2012-01-30 17:27 |只看该作者
    zjzhouzg 发表于 2008-05-13 19:46
    环境:CentOS5的Linux操作系统,并且经过Vsftpd+yum server的处理,这个是宿主机。地址是192.168.0.234。
    ...



    楼主好,我在xen上安装 虚机的时候 , 虚机一直卡在如下画面 ,不动了 !!!

    ---------------------
    TCP bic registered
    Initializing IPsec netlink socket
    NET: Registered protocol family 1
    NET: Registered protocol family 17
    Using IPI No-Shortcut mode
    XENBUS: Device with no driver: device/vbd/51712
    XENBUS: Device with no driver: device/vif/0
    Initalizing network drop monitor service
    Freeing unused kernel memory: 184k freed
    Write protecting the kernel read-only data: 399k





    请教一下是什么问题吗 ,都1周了没解决这个问题 。。。要疯掉了 {:2_177:}



    --------------
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则 发表回复

      

    北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
    未成年举报专区
    中国互联网协会会员  联系我们:huangweiwei@itpub.net
    感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

    清除 Cookies - ChinaUnix - Archiver - WAP - TOP