mkdir /var/image-create
cd /var/image-create/

在物理机上:

wget http://10.254.3.75/images/libvirt/libvirt.xml

如果不通,试试route -n;     route add -net 10.254.3.0/24 gw 10.254.99.254 dev eth3;

(另,10.254.3.75/images的虚机映射地址为10.133.28.75/images,若是在虚机上下载文件,使用:wget http://10.133.28.75/images/libvirt/libvirt.xml)

下载两个windows驱动

wget http://10.254.3.75/images/virtio-win/virtio-win-0.1.96.iso

wget http://10.254.3.75/images/virtio-win/virtio-win-0.1.96_amd64.vfd

创建目标镜像文件:qemu-img create -f qcow2 /var/image-create/bcec-windows-2012-R2-standard-amd64-10G.qcow2 10G

配置libvirt.xml:

 <domain type='kvm'>
<name>windows 2012</name> <!--虚拟机名称-->
<memory>16085760</memory> <!--最大内存,单位k-->
<vcpu>8</vcpu> <!--虚拟cpu个数-->
<os>
<type arch='x86_64' machine='pc'>hvm</type> <!--此处的machine在不通环境下可能需要设置-->
<boot dev='hd'/> <!--硬盘启动-->
<boot dev='cdrom'/> <!--光盘启动-->
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator> <disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/var/image-create/bcec-windows-2012-R2-standard-amd64-10G.qcow2'/> <!--目的镜像路径-->
<target dev='vda' bus='virtio'/>
</disk> <disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/var/image-create/cn_windows_server_2012_r2_vl_x64_dvd_2979220.iso'/> <!--光盘镜像路径-->
<target dev='hda' bus='ide'/>
<readonly/>
</disk> <disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/var/image-create/virtio-win-0.1.96.iso'/>
<target dev='hdb' bus='ide'/>
<readonly/>
</disk>
<disk type='file' device='floppy'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/var/image-create/virtio-win-0.1.96_amd64.vfd'/>
<target dev='fda' bus='fdc'/>
</disk> <interface type='bridge'> <!--虚拟机网络连接方式-->
<source bridge='virbr0'/> <!--当前主机网桥的名称-->
<mac address='02:00:0a:78:41:14'/>
<model type='virtio'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<!--vnc方式登录,端口号自动分配,自动加1,可以通过virsh vncdisplay来查询-->
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>
</graphics>
</devices>
</domain>

此时使用virsh create libvirt.xml,提示找不到/usr/bin/qemu-system-x86_64

可用which qemu-system-x86_64,得出路径/usr/bin/qemu-system-x86_64

再rpm -qf /usr/bin/qemu-system-x86_64,查看版本为:xxxx-xxx-xxx-xxxxx

和qemu-kvm-2.0.0-4.mira2.x86_64不一样,则yum qemu-kvm-2.0.0-4.mira2.x86_64覆盖安装即可。

使用Xmanager Enterprise,在Properties里设置如下:

【制作镜像Win*】文件准备-LMLPHP

安装tigervnc-1.1.0-5.el6_4.1.x86_64

virsh create libvirt.xml

vncviewer 127.0.0.1

在图形界面安装系统

05-07 13:48