|
|
Line 1: |
Line 1: |
| | | <div class="media"><a class="pull-left" href="<!--{$user|escape:'url'}-->"><img class="media-object" src="<!--{$gravatar_url|escape:'html'}-->" alt="<!--{$user|escape:'html'}-->"></a> |
| == Introduction == | | <div class="media-body"> |
| | | <a href="<!--{$article_url|escape:'html'}-->"><h4 class="media-heading"><!--{$title|escape:'html'}--></h4></a> |
| KVM is a hardware-accelerated full-machine hypervisor and virtualization solution included as part of kernel 2.6.20 and later. It allows you to create and start hardware-accelerated virtual machines under Linux using the QEMU tools.
| | <!--{$body|escape:'html'}--> |
| | | </div> |
| == Kernel Setup == | | <div style="float: right; text-align: right; display: inline-block;"> |
| | | <span style="color: #888; font-size: 10px;"><!--{$date|escape:'html'}--> by <a href="<!--{$user|escape:'html'}-->"><!--{$user|escape:'html'}--></a></span> |
| To enable KVM, the following kernel config parameters should be enabled (this is based on a 3.x kernel):
| | </div> |
| | | </div> |
| Under <code>Processor type and features</code>, enable <code>Linux guest support</code>, and enable the following options:
| |
| | |
| {{kernelop|title=Processor type and features,Linux guest support|desc=
| |
| --- Linux guest support | |
| [*] Enable paravirtualization code
| |
| [ ] paravirt-ops debugging (NEW)
| |
| [*] Paravirtualization layer for spinlocks
| |
| [ ] Xen guest support (NEW)
| |
| [*] KVM Guest support (including kvmclock) (NEW)
| |
| [ ] Enable debug information for KVM Guests in debugfs (NEW)
| |
| [ ] Paravirtual steal time accounting (NEW)
| |
| }}
| |
| | |
| | |
| Under the <code>Virtualization</code> category from the main kernel config menu, enable <code>Kernel-based Virtual Machine (KVM) support</code>, and enable at least one type of KVM, either for Intel or AMD processors. It is also recommended to enable <code>Host kernel acceleration for virtio net</code>.
| |
| | |
| {{kernelop|title=Virtualization|desc= | |
| --- Virtualization | |
| <M> Kernel-based Virtual Machine (KVM) support
| |
| <M> KVM for Intel processors support | |
| <M> KVM for AMD processors support | |
| [*] KVM legacy PCI device assignment support
| |
| <M> Host kernel accelerator for virtio net | |
| }} | |
| | |
| | |
| You can use modules or build these parts directly into the kernel. Build your new kernel and modules, and reboot.
| |
| | |
| == User-space tools ==
| |
| | |
| If you are using QEMU on your desktop, add the following USE flag to <code>/etc/portage/make.conf</code>:
| |
| | |
| <pre> | |
| USE="$USE usbredir"
| |
| </pre> | |
| This will enable good mouse support for QEMU on your desktop.
| |
| | |
| Now, emerge qemu:
| |
| | |
| <console>
| |
| # ##i## emerge qemu | |
| </console>
| |
| | |
| ==Initial Setup==
| |
| | |
| Prior to using KVM, modprobe the appropriate accelerated driver for Intel or AMD:
| |
| | |
| <console>
| |
| # ##i##modprobe kvm_intel
| |
| </console> | |
| | |
| == Next Steps ==
| |
| | |
| {{important|Before using KVM, be sure that your user account is in the <code>kvm</code> group. You will need to use a command such as <code>vigr</code> or <code>gpasswd -a $USER kvm</code> as root to do this, and then log out and log back in for this to take effect.}} | |
| | |
| {{important|Atm the group <code>kvm</code> has no access to /dev/kvm. Change this with
| |
| chown root:kvm /dev/kvm
| |
| chmod g+rw /dev/kvm
| |
| and kvm will start like expected [https://bugs.funtoo.org/browse/FL-1626 (see bug FL-1626)] }}
| |
| | |
| For information on how to use KVM with various operating systems, see:
| |
| | |
| * [[Windows 7 Virtualization with KVM]]
| |
| * [[Linux on KVM]]
| |
| | |
| [[Category:Virtualization]]
| |
| [[Category:KVM]]
| |