Linux/KVM: Difference between revisions
< Linux
No edit summary |
|||
Line 1: | Line 1: | ||
== Ubuntu 12.04 KVM Host == | == Ubuntu 12.04 KVM Host == | ||
=== Installation === | |||
<blockquote> | <blockquote> | ||
<pre> | <pre> | ||
Line 7: | Line 7: | ||
apt-get install virtinst libvirt-bin virt-top (cli) | apt-get install virtinst libvirt-bin virt-top (cli) | ||
apt-get install virt-manager (gui) | apt-get install virt-manager (gui) | ||
</pre> | </pre> | ||
</blockquote> | </blockquote> | ||
=== network bridge === | |||
* installation: | |||
<blockquote> | <blockquote> | ||
<pre> | <pre> | ||
Line 20: | Line 18: | ||
</blockquote> | </blockquote> | ||
* /etc/network/interfaces | |||
<blockquote> | <blockquote> | ||
<pre> | <pre> | ||
Line 43: | Line 41: | ||
=== vm guest setup === | |||
* control | |||
<blockquote> | <blockquote> | ||
<pre> | <pre> | ||
Line 58: | Line 57: | ||
</blockquote> | </blockquote> | ||
* /etc/libvirt/qemu/win7.xml | |||
* | |||
<blockquote> | <blockquote> | ||
<pre> | <pre> | ||
<domain type='kvm'> | |||
<name>Win7</name> | |||
<uuid>??????</uuid> | |||
<memory>4194304</memory> | |||
<currentMemory>4194304</currentMemory> | |||
<vcpu cpuset='0-3'>4</vcpu> | |||
<os> | |||
<type arch='x86_64' machine='pc-1.0'>hvm</type> | |||
<boot dev='hd'/> | |||
</os> | |||
<features> | |||
<acpi/> | |||
<apic/> | |||
<pae/> | |||
</features> | |||
<cpu match='exact'> | |||
<model>Westmere</model> | |||
<vendor>Intel</vendor> | |||
</cpu> | |||
<clock offset='localtime'/> | |||
<on_poweroff>destroy</on_poweroff> | |||
<on_reboot>restart</on_reboot> | |||
<on_crash>restart</on_crash> | |||
<devices> | |||
<emulator>/usr/bin/kvm</emulator> | |||
<disk type='file' device='cdrom'> | |||
<driver name='qemu' type='raw'/> | |||
<target dev='hdc' bus='ide'/> | |||
<readonly/> | |||
<address type='drive' controller='0' bus='1' unit='0'/> | |||
</disk> | |||
<disk type='file' device='disk'> | |||
<driver name='qemu' type='raw' cache='none'/> | |||
<source file='/srv/kvm/vm-win7/vm-win7.img'/> | |||
<target dev='vdb' bus='virtio'/> | |||
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> | |||
</disk> | |||
<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:4e:6d:bf'/> | |||
<source bridge='br0'/> | |||
<model type='virtio'/> | |||
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> | |||
</interface> | |||
<input type='tablet' bus='usb'/> | |||
<input type='mouse' bus='ps2'/> | |||
<graphics type='vnc' port='-1' autoport='yes'/> | |||
<sound model='ich6'> | |||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> | |||
</sound> | |||
<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='0x05' function='0x0'/> | |||
</memballoon> | |||
</devices> | |||
</domain> | |||
</pre> | </pre> |
Revision as of 18:17, 10 November 2012
Ubuntu 12.04 KVM Host
Installation
kvm-ok (cpu ok?) apt-get install ubuntu-virt-server qemu-kvm kvm-ipxe apt-get install virtinst libvirt-bin virt-top (cli) apt-get install virt-manager (gui)
network bridge
- installation:
apt-get install bridge-utils
- /etc/network/interfaces
auto lo iface lo inet loopback auto eth0 iface eth0 inet manual auto br0 iface br0 inet static address 192.168.111.10 netmask 255.255.255.0 gateway 192.168.111.1 dns-nameservers 192.168.111.1 bridge_ports eth0 bridge_stp off bridge_fd 0 bridge_maxwait 0
vm guest setup
- control
virsh --connect qemu:///system : help : list --all : define /etc/libvirt/qemu/vm-???.xml : start vm-??? : shutdown vm-??? : destroy vm-??? : quit
- /etc/libvirt/qemu/win7.xml
<domain type='kvm'> <name>Win7</name> <uuid>??????</uuid> <memory>4194304</memory> <currentMemory>4194304</currentMemory> <vcpu cpuset='0-3'>4</vcpu> <os> <type arch='x86_64' machine='pc-1.0'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <cpu match='exact'> <model>Westmere</model> <vendor>Intel</vendor> </cpu> <clock offset='localtime'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <target dev='hdc' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> <disk type='file' device='disk'> <driver name='qemu' type='raw' cache='none'/> <source file='/srv/kvm/vm-win7/vm-win7.img'/> <target dev='vdb' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </disk> <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:4e:6d:bf'/> <source bridge='br0'/> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </interface> <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'/> <sound model='ich6'> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> <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='0x05' function='0x0'/> </memballoon> </devices> </domain>
Iommu
- grub.cfg (Ubuntu 12.04)
linux /boot/*** intel_iommu=on