本文共 2510 字,大约阅读时间需要 8 分钟。
半虚拟化
创建配置文件
参考centos.5-0.xen2.cfg和centos.5-0.xen3.cfg,其内容为: kernel = “/boot/vmlinuz-2.6.18-xen” ramdisk = “/boot/initrd-2.6.18-xen.img” memory = 256 name = “centos.5-0” dhcp = “dhcp” vif = [ ‘’ ] disk = [‘tap:aio:/home/xen/centos.5-0.img,xvda1,w’, ‘tap:aio:/home/xen/centos.swap,xvda2,w’] root = “/dev/xvda1 ro”Integrating Loadable Kernel Modules into Your Root Filesystem
$ uname -r 2.6.18-xen $ su Password: ********* # mkdir -p /mnt/img # mount -o loop centos.5-0.img /mnt/img # cd /mnt/img/lib/modules # cp -r /lib/modules/`uname -r` . # ls 2.6.18-xen修改其他的配置文件
# cat /mnt/img/etc/fstab /dev/xvda1 / ext3 defaults 1 1 /dev/xvda2 none swap sw 0 0 none /dev/pts devpts gid=5,mode=620 0 0 none /dev/shm tmpfs defaults 0 0 none /proc proc defaults 0 0 none /sys sysfs defaults 0 0 # cat /mnt/img/etc/sysconfig/network-scripts/ifcfg-eth0 TYPE=Ethernet DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yes # cat /mnt/img/etc/network/interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp # cd / # sync # umount /mnt/img Creating Initial RAM Disks and Filesystems for Your Kernel # yaird --output initrd-2.6.18-xen.img 2.6.18-xen # mkinitramfs -o initrd-2.6.18-xen.img 2.6.18-xen # mkinitrd -o initrd-2.6.18-xen.img 2.6.18-xen启动虚拟机
# xm create centos.5-0.xen3.cfg -c # xm list Name ID Mem(MiB) VCPUs State Time(s) Domain-0 0 1752 2 r----- 56978.8 Foresight 46 384 1 -b---- 1180.1 OpenSUSE 17 256 1 -b---- 2114.4 Ubuntu 34 256 1 -b---- 591.7 centos.5-0 45 256 1 -b---- 302.9 Freespire-HVM 49 256 1 -b---- 63.2
连接到虚拟机的终端
#xm console 45 &全虚拟化HVM
如果想要配置SDL,需要设置:
sdl=1 vnc=0 启动虚拟机 # xm create freespire.cfg –c 自动启动Domains将配置文件放到/etc/xen/auto/目录
本文转自feisky博客园博客,原文链接:http://www.cnblogs.com/feisky/archive/2011/05/23/2054729.html,如需转载请自行联系原作者