作者:he小任a | 来源:互联网 | 2014-05-27 20:19
OS:LINUXubuntu9.10serverstep0:将xpsp2.iso放在/home/xeniso/里step1:apt-getinstallubuntu-xen-serverstep2:gedit/etc/xen/xend-config.sxp将#(vnc-listen’127.0.0.1′)改为(vnc-
OS: LINUX ubuntu 9.10 server
step0: 将xpsp2.iso放在 /home/xeniso/里
step1: apt-get install ubuntu-xen-server
step2: gedit /etc/xen/xend-config.sxp
将#(vnc-listen ’127.0.0.1′)
改为(vnc-listen ’0.0.0.0′)
step3: reboot
step4: dd if=/dev/zero of=/home/xeniso/xpsp2.img bs=1 count=0
seek=20G
step5: losetup -f /home/xeniso/xpsp2.iso
step6: gedit /etc/xen/xp.cfg
内容为
# -*- mode: python; -*-
import os, re
arch = os.uname()[4]
if re.search(’64′, arch):
arch_libdir = ‘lib64′
else:
arch_libdir = ‘lib’
kernel = ‘/usr/’+ arch_libdir +’/xen/boot/hvmloader’
builder=’hvm’
memory = 512
shadow_memory = 8
name = “xp”
vif = [ 'type=ioemu, bridge=eth0' ]
disk = [
'tap:aio:/home/xeniso/xpsp2.img,hda,w',
'phy:/dev/loop0,hdc:cdrom,r'
]
boot = “dc”
device_model = ‘/usr/’ + arch_libdir + ‘/xen/bin/qemu-dm’
vnc=1
vncpasswd=”
serial=’pty’
sdl=1
#注意网卡是否为eth0 可用ifconfig查询
step7: xm create /etc/xen/xp.cfg
指启动虚拟器,但如出现以下的错误
ERROR Internal error: Could not obtain handle on privileged
command interface (2 = No such file or directory)
Traceback (most recent call last):
File “/usr/sbin/xm”, line 8, in
from xen.xm import main
File “/usr/lib/python2.6/dist-packages/xen/xm/main.py”,
line 61, in
xc = xen.lowlevel.xc.xc()
xen.lowlevel.xc.Error: (1, ‘Internal error’, ‘Could not obtain
handle on privileged command interface (2 = No such file or
directory)’)
使用gedit /proc/cpuinfo
查看CPU有无支援虚拟化
intel: flag栏位要有vmx 和 tm
amd: flag栏位要有svm 和 tm
如果没有,很抱歉,此电脑不支援xen
step8: vncviewer xenIP
指启动远端vnc
step9:
xm reboot xp
xm shutdown xp
重开与关机
step10: ln -s /etc/xen/xp.cfg /etc/xen/auto/
开机启动虚拟器
OS: LINUX CentOS 5.4
step1: install VMware tools
step2: yum install kernel
step3: yum update kernel
step4: yum install kernel-xen xen xen-libs python-virtinst
virt-manager
step5: rum virt-manager
step6: new virtual machine and run