If you followed the setup of the KVM host at KVM_Setup_on_Debian_Squeeze you will notice that we are using libvirt to manage and control KVM. You should also have a Linux Virtual Machine setup using virt-install. This is required, as we are going to copy its libvirt xml config, edit it and then save it and create our own config for this Windows VM.
I place all ISOs on the KVM host at: /srv/os-images/ In the config below I add in the config to provide a boot menu allowing me to boot from the HD or CDROM at a later date (see: Provide_Boot_Menu_options_for_VMs_accessible_using_VNC )
lvcreate -n win01-vm –size 50g vg0 cd /etc/libvirt/qemu cp lin01-vm.xml win01-vm.xml vi win01-vm
When editing the copy of the xml config, we need to remove any UUID, MAC address and/or unique identifiers. The config below uses br1 bridge which is on a 192.168.1.1/255 range. I am not using virtio for the Windows VM (at this stage).
<domain type='kvm'>
<name>win01-vm</name> <memory>524288</memory> <currentMemory>524288</currentMemory> <vcpu>1</vcpu> <os> <type arch='x86_64' machine='pc-0.12'>hvm</type> <boot dev='hd'/> <boot dev='cdrom'/> <bootmenu enable='yes'/> </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/kvm</emulator> <disk type='block' device='disk'> <target dev='hda' bus='ide'/> <source dev='/dev/vg0/win01-vm'/> </disk> <disk type='file' device='cdrom'> <target dev='hdc' bus='ide'/> <source file='/srv/os-images/en_windows_server_2008_r2_standard.iso'/> </disk> <interface type='bridge'> <source bridge='br1'/> </interface> <serial type='pty'> <target port='0'/> </serial> <console type='pty'> <target type='serial' port='0'/> </console> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' keymap='de'/> <video> <model type='cirrus' vram='9216' heads='1'/> </video> </devices>
</domain>
Once the config is edited, we need to define it, look at the resulting completed config and then start the VM. virsh define win01-vm.xml vi win01-vm.xml #You will notice extra uuid's and mac address added in. virsh list –all virsh start win01-vm The vm will now start. Connect using VNC. You can right-click on the VNC window titlebar, send a CTRL+ALT+DELETE to reboot and then press F12 to see the boot bios.
Note: a server core install of windows server 2008 is a minimal install of ~2-3gb with only a command line interface. You can download the installation guide at: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=518d870c-fa3e-4f6a-97f5-acaf31de6dce&DisplayLang=en and read more info at: http://technet.microsoft.com/en-us/library/cc753802(WS.10).aspx