Linux/KVM: Difference between revisions
< Linux
No edit summary |
|||
(14 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
</pre> | </pre> | ||
</blockquote> | </blockquote> | ||
* https://launchpad.net/~dnjl/+archive/virtualization | |||
=== network bridge === | === network bridge === | ||
Line 49: | Line 51: | ||
: list --all | : list --all | ||
: capabilities | |||
: define /etc/libvirt/qemu/vm-???.xml | : define /etc/libvirt/qemu/vm-???.xml | ||
: start vm-??? | : start vm-??? | ||
Line 108: | Line 111: | ||
<input type='tablet' bus='usb'/> | <input type='tablet' bus='usb'/> | ||
<input type='mouse' bus='ps2'/> | <input type='mouse' bus='ps2'/> | ||
<graphics type='vnc' port=' | <graphics type='vnc' port='5911'> | ||
<listen type='address' address='192.168.$0.$10'/> | |||
</graphics> | |||
<sound model='ich6'> | <sound model='ich6'> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> | <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> | ||
Line 114: | Line 119: | ||
<video> | <video> | ||
<model type='vga' vram='9216' heads='1'/> | <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> | |||
</blockquote> | |||
* /etc/libvirt/qemu/ubuntu.xml | |||
<blockquote> | |||
<pre> | |||
<domain type='kvm'> | |||
<name>vm-dev</name> | |||
<uuid>??????</uuid> | |||
<memory>1048576</memory> | |||
<currentMemory>1048576</currentMemory> | |||
<vcpu>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> | |||
<feature policy='require' name='tm2'/> | |||
<feature policy='require' name='est'/> | |||
<feature policy='require' name='monitor'/> | |||
<feature policy='require' name='ss'/> | |||
<feature policy='require' name='vme'/> | |||
<feature policy='require' name='rdtscp'/> | |||
<feature policy='require' name='ht'/> | |||
<feature policy='require' name='ds'/> | |||
<feature policy='require' name='pbe'/> | |||
<feature policy='require' name='tm'/> | |||
<feature policy='require' name='vmx'/> | |||
<feature policy='require' name='ds_cpl'/> | |||
<feature policy='require' name='xtpr'/> | |||
<feature policy='require' name='acpi'/> | |||
</cpu> | |||
<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='file' device='disk'> | |||
<driver name='qemu' type='raw' cache='none'/> | |||
<source file='/srv/kvm/ubuntu/ubuntu.img'/> | |||
<target dev='vda' bus='virtio'/> | |||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> | |||
</disk> | |||
<interface type='bridge'> | |||
<mac address='xx:xx:xx:xx:xx:xx'/> | |||
<source bridge='br0'/> | |||
<model type='e1000'/> | |||
<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='mouse' bus='ps2'/> | |||
<graphics type='vnc' port='-1' autoport='yes'/> | |||
<video> | |||
<model type='cirrus' vram='9216' heads='1'/> | |||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> | <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> | ||
</video> | </video> | ||
Line 129: | Line 211: | ||
<blockquote> | |||
<pre> | |||
<cpu mode='host-passthrough'/> | |||
</pre> | |||
</blockquote> | |||
== virt-manager == | |||
add user to group "libvirtd" | |||
== Links: == | |||
* http://www.howtoforge.com/virtualization-with-kvm-on-ubuntu-12.04-lts | |||
* https://help.ubuntu.com/community/KVM/Managing#Adding_USB_Device_Pass-through | |||
== EFI == | |||
* | * Set during initial machine creation | ||
== Iommu == | == Iommu == | ||
Line 142: | Line 234: | ||
</pre> | </pre> | ||
</blockquote> | </blockquote> | ||
<blockquote> | |||
<pre> | |||
reboot | |||
dmesg | grep IOMMU | |||
</pre> | |||
</blockquote> | |||
http://debianforum.de/forum/viewtopic.php?f=32&t=129379 | |||
[[Category:Linux/Virtualization]] | |||
[[Category:Linux]] |
Latest revision as of 20:53, 21 September 2018
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 : capabilities : 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/win7/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='xx:xx:xx:xx:xx:xx'/> <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='5911'> <listen type='address' address='192.168.$0.$10'/> </graphics> <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>
- /etc/libvirt/qemu/ubuntu.xml
<domain type='kvm'> <name>vm-dev</name> <uuid>??????</uuid> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <vcpu>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> <feature policy='require' name='tm2'/> <feature policy='require' name='est'/> <feature policy='require' name='monitor'/> <feature policy='require' name='ss'/> <feature policy='require' name='vme'/> <feature policy='require' name='rdtscp'/> <feature policy='require' name='ht'/> <feature policy='require' name='ds'/> <feature policy='require' name='pbe'/> <feature policy='require' name='tm'/> <feature policy='require' name='vmx'/> <feature policy='require' name='ds_cpl'/> <feature policy='require' name='xtpr'/> <feature policy='require' name='acpi'/> </cpu> <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='file' device='disk'> <driver name='qemu' type='raw' cache='none'/> <source file='/srv/kvm/ubuntu/ubuntu.img'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> <interface type='bridge'> <mac address='xx:xx:xx:xx:xx:xx'/> <source bridge='br0'/> <model type='e1000'/> <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='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'/> <video> <model type='cirrus' 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>
<cpu mode='host-passthrough'/>
virt-manager
add user to group "libvirtd"
Links:
- http://www.howtoforge.com/virtualization-with-kvm-on-ubuntu-12.04-lts
- https://help.ubuntu.com/community/KVM/Managing#Adding_USB_Device_Pass-through
EFI
- Set during initial machine creation
Iommu
- grub.cfg (Ubuntu 12.04)
linux /boot/*** intel_iommu=on
reboot dmesg | grep IOMMU