安装光盘使用UltraISO集成驱动,很简单,这里就不多说了
[root@192 vm]# qemu-img create -f qcow2 vm04.img 40G
Formatting 'vm04.img', fmt=qcow2 size=42949672960 encryption=off cluster_size=65536
[root@192 vm]# ls
vm04.img
[root@192 vm]# virt-install \
> --hvm \
> --name=vm04 \
> --os-type='windows' \
> --ram 4096 \
> --vcpus=2 \
> --disk path=/home/vm/vm04.img,format=qcow2,size=40,bus=virtio,device=disk \
> --cdrom /home/iso/win2008r2_x64_virtio.iso \
> --vnc \
> --vncport=5912 \
> --network bridge=br0,model=virtio
Starting install...
Creating domain... | 0 B 00:01
Cannot open display:
Run 'virt-viewer --help' to see a full list of available command line options
Domain installation still in progress. Waiting for installation to complete.
使用vnc viewer连接安装系统
会发现找不到硬盘,浏览驱动目录并加载后就可以正常安装了
安装完后设备如下
虚拟机配置文件
[root@192 qemu]# cat vm04.xml
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh edit vm04
or other application using the libvirt API.
-->
<domain type='kvm'>
<name>vm04</name>
<uuid>50588d3b-3cc0-a8cb-815d-e414c4e7d260</uuid>
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='x86_64' machine='rhel6.6.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='localtime'>
<timer name='rtc' tickpolicy='catchup'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/home/vm/vm04.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/home/iso/win2008r2_x64_virtio.iso'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk>
<controller type='usb' index='0' model='ich9-ehci1'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci1'>
<master startport='0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci2'>
<master startport='2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci3'>
<master startport='4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/>
</controller>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:7c:3f:60'/>
<source bridge='br0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</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'/>
<graphics type='vnc' port='5912' autoport='no'/>
<video>
<model type='vga' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>
[root@192 qemu]#