在XEN虚拟化环境中创建HVM模式虚拟机

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在XEN虚拟化环境中创建HVM模式虚拟机相关的知识,希望对你有一定的参考价值。

创建HVM格式的CentOS虚拟机:

1、创建磁盘文件

[[email protected] xen]# dd if=/dev/zero of=/images/xen/centos6-hvm.img bs=100M count=100

记录了100+0 的读入

记录了100+0 的写出

10485760000字节(10 GB)已复制,148.453 秒,70.6 MB/秒

2、编辑虚拟机配置文件

[[email protected] opt]# vi /etc/xen/centos6-hvm.cfg 

[[email protected] opt]# cat /etc/xen/centos6-hvm.cfg 

kernel = "hvmloader"

builder = 'hvm'

name = "centos6-hvm"

vcpus = 1

memory = 1024

on_reboot = 'destroy'

disk = [ 'file:/images/xen/centos6-hvm.img,hda,w','file:/opt/CentOS-6.5-x86_64-bin-DVD1.iso,hdc:cdrom,r' ]

vif = [ 'type=ioemu, bridge=br0' ]

vnc = 1

vnclisten = '0.0.0.0'

sdl = 0

boot = "dc"

3、创建虚拟机

[[email protected] opt]# xl create /etc/xen/centos6-hvm.cfg 

4、安装系统

技术分享图片

技术分享图片

5、修改配置文件

[[email protected] opt]# vi /etc/xen/centos6-hvm.cfg 

[[email protected] opt]# cat /etc/xen/centos6-hvm.cfg 

kernel = "hvmloader"

builder = 'hvm'

name = "centos6-hvm"

vcpus = 1

memory = 1024

disk = [ 'file:/images/xen/centos6-hvm.img,hda,w' ]

vif = [ 'type=ioemu, bridge=br0' ]

vnc = 1

vnclisten = '0.0.0.0'

sdl = 0

boot = "dc"

on_poweroff = 'destroy'

on_reboot = 'restart'

on_crash = 'restart'

6、启动虚拟机,使用vncviewer连接并测试

[[email protected] opt]# xl create /etc/xen/centos6-hvm.cfg

[[email protected] opt]# vncviewer :5900

技术分享图片



创建HVM模式的winxp虚拟机:

1、创建虚拟机磁盘文件

[[email protected] xen]# dd if=/dev/zero of=/images/xen/winxp.img bs=100M count=100

记录了100+0 的读入

记录了100+0 的写出

10485760000字节(10 GB)已复制,137.431 秒,76.3 MB/秒

2、创建虚拟机配置文件

[[email protected] xen]# vi /etc/xen/winxp.cfg 

[[email protected] xen]# cat /etc/xen/winxp.cfg 

kernel = "hvmloader"

builder = 'hvm'

name = "winxp"

vcpus = 1

memory = 1024

disk = [ 'file:/images/xen/winxp.img,hda,w','file:/opt/DBX_GHOST_XP_SP3_CJ_V3.5.iso,hdc:cdrom,r' ]

vif = [ 'type=ioemu, bridge=br0' ]

vnc = 1

vnclisten = '0.0.0.0'

sdl = 0

acpi = 1

apic = 1

boot = "dc"

on_reboot = 'destroy'

serial = 'pty'

usbdevice = 'tablet'

3、启动虚拟机

[[email protected] xen]# xl create /etc/xen/winxp.cfg 

4、安装操作系统

技术分享图片

技术分享图片

5、修改配置文件

kernel = "hvmloader"

builder = 'hvm'

name = "winxp"

vcpus = 1

memory = 1024

disk = [ 'file:/images/xen/winxp.img,hda,w' ]

vif = [ 'type=ioemu, bridge=br0' ]

vnc = 1

vnclisten = '0.0.0.0'

sdl = 0

acpi = 1

apic = 1

boot = "dc"

on_reboot = 'restart'

on_shutdown = 'destroy'

on_crash = 'restart'

usbdevice = 'tablet'

6、使用新的配置文件重新启动虚拟机

[[email protected] xen]# xl create /etc/xen/winxp.cfg 


以上是关于在XEN虚拟化环境中创建HVM模式虚拟机的主要内容,如果未能解决你的问题,请参考以下文章

7xen虚拟机开机自启动配置

虚拟化技术比较 PV HVM

Xen server虚拟化中虚拟机磁盘文件丢失的处理办法

Xen搭建虚拟机实现VNC访问

虚拟化技术xen的简介和安装

1xen虚拟化环境安装