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:
1 <domain type='kvm'> 2 <name>windows 2012</name> <!--虚拟机名称--> 3 <memory>16085760</memory> <!--最大内存,单位k--> 4 <vcpu>8</vcpu> <!--虚拟cpu个数--> 5 <os> 6 <type arch='x86_64' machine='pc'>hvm</type> <!--此处的machine在不通环境下可能需要设置--> 7 <boot dev='hd'/> <!--硬盘启动--> 8 <boot dev='cdrom'/> <!--光盘启动--> 9 </os> 10 <features> 11 <acpi/> 12 <apic/> 13 <pae/> 14 </features> 15 <clock offset='utc'/> 16 <on_poweroff>destroy</on_poweroff> 17 <on_reboot>restart</on_reboot> 18 <on_crash>restart</on_crash> 19 <devices> 20 <emulator>/usr/bin/qemu-system-x86_64</emulator> 21 22 <disk type='file' device='disk'> 23 <driver name='qemu' type='qcow2' cache='none'/> 24 <source file='/var/image-create/bcec-windows-2012-R2-standard-amd64-10G.qcow2'/> <!--目的镜像路径--> 25 <target dev='vda' bus='virtio'/> 26 </disk> 27 28 <disk type='file' device='cdrom'> 29 <driver name='qemu' type='raw'/> 30 <source file='/var/image-create/cn_windows_server_2012_r2_vl_x64_dvd_2979220.iso'/> <!--光盘镜像路径--> 31 <target dev='hda' bus='ide'/> 32 <readonly/> 33 </disk> 34 35 <disk type='file' device='cdrom'> 36 <driver name='qemu' type='raw'/> 37 <source file='/var/image-create/virtio-win-0.1.96.iso'/> 38 <target dev='hdb' bus='ide'/> 39 <readonly/> 40 </disk> 41 <disk type='file' device='floppy'> 42 <driver name='qemu' type='raw' cache='none'/> 43 <source file='/var/image-create/virtio-win-0.1.96_amd64.vfd'/> 44 <target dev='fda' bus='fdc'/> 45 </disk> 46 47 <interface type='bridge'> <!--虚拟机网络连接方式--> 48 <source bridge='virbr0'/> <!--当前主机网桥的名称--> 49 <mac address='02:00:0a:78:41:14'/> 50 <model type='virtio'/> 51 </interface> 52 <serial type='pty'> 53 <target port='0'/> 54 </serial> 55 <console type='pty'> 56 <target type='serial' port='0'/> 57 </console> 58 <input type='tablet' bus='usb'/> 59 <input type='mouse' bus='ps2'/> 60 <!--vnc方式登录,端口号自动分配,自动加1,可以通过virsh vncdisplay来查询--> 61 <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'> 62 <listen type='address' address='0.0.0.0'/> 63 </graphics> 64 </devices> 65 </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里设置如下:
安装tigervnc-1.1.0-5.el6_4.1.x86_64
virsh create libvirt.xml
vncviewer 127.0.0.1
在图形界面安装系统