安装Xen:
# yum install kernel-xen xen
重启,启动时选择xen的内核
启动后查看Xen的状态:
# xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 747 2 r—– 3623.1
安装虚拟机:
virt-install -n centos -r 256 -f /home/feisky/xen/centos.img -s 4 –nographics -p -lhttp://mirrors.163.com/centos/5.6/os/i386
安装完成后,会在/etc/xen下面生成一个配置文件:
name = “centos”
uuid = “40ded0f5-0b0b-d556-5590-f6f987beed95″
maxmem = 256
memory = 256
vcpus = 1
bootloader = “/usr/bin/pygrub”
on_poweroff = “destroy”
on_reboot = “restart”
on_crash = “restart”
disk = [ "tap:aio:/home/feisky/xen/centos.img,xvda,w" ]
vif = [ "mac=00:16:36:5f:0f:72,bridge=xenbr0,script=vif-bridge" ]
启动虚拟机:
# xm create centos
# xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 747 2 r—– 3643.4
centos 6 256 1 r—– 16.2
连接到虚拟机的终端:
#xm console 6
Linux version 2.6.18-238.el5xen (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Thu Jan 13 17:49:40 EST 2011
BIOS-provided physical RAM map:
Xen: 0000000000000000 – 0000000010800000 (usable)
0MB HIGHMEM available.
264MB LOWMEM available.
…………………………
或者使用Xterm来连接:xterm -T CentOS -e xm console 1 &
使用快捷键Ctrl+]退出虚拟机终端