The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "KVM"
(Added hint to change rights of /dev/kvm) |
m (added a link to the windows 10 virtulaization page) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 8: | Line 8: | ||
To enable KVM, the following kernel config parameters should be enabled (this is based on a 3.x kernel): | To enable KVM, the following kernel config parameters should be enabled (this is based on a 3.x kernel): | ||
Under < | 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= | {{kernelop|title=Processor type and features,Linux guest support|desc= | ||
Line 22: | Line 22: | ||
Under the < | 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= | {{kernelop|title=Virtualization|desc= | ||
Line 38: | Line 38: | ||
== User-space tools == | == User-space tools == | ||
If you are using QEMU on your desktop, add the following USE flag to < | If you are using QEMU on your desktop, add the following USE flag to <code>/etc/portage/make.conf</code>: | ||
<pre> | <pre> | ||
Line 58: | Line 58: | ||
# ##i##modprobe kvm_intel | # ##i##modprobe kvm_intel | ||
</console> | </console> | ||
{{note|Alternatively you can edit /etc/conf.d/modules to load it automatically}} | |||
== Next Steps == | == 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 < | {{important|Atm the group <code>kvm</code> has no access to /dev/kvm. Change this with | ||
<console> | |||
# ##i##chown root:kvm /dev/kvm | |||
# ##i##chmod g+rw /dev/kvm | |||
</console> | |||
and kvm will start like expected [https://bugs.funtoo.org/browse/FL-1626 (see bug FL-1626)] }} | and kvm will start like expected [https://bugs.funtoo.org/browse/FL-1626 (see bug FL-1626)] }} | ||
Line 71: | Line 75: | ||
* [[Windows 7 Virtualization with KVM]] | * [[Windows 7 Virtualization with KVM]] | ||
* [[Windows 10 Virtualization with KVM]] | |||
* [[Linux on KVM]] | * [[Linux on KVM]] | ||
[[Category:Virtualization]] | [[Category:Virtualization]] | ||
[[Category:KVM]] | [[Category:KVM]] |
Latest revision as of 08:37, May 25, 2020
Introduction
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.
Kernel Setup
To enable KVM, the following kernel config parameters should be enabled (this is based on a 3.x kernel):
Under Processor type and features
, enable Linux guest support
, and enable the following options:
Under Processor type and features-->Linux guest support:
--- 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 Virtualization
category from the main kernel config menu, enable Kernel-based Virtual Machine (KVM) support
, and enable at least one type of KVM, either for Intel or AMD processors. It is also recommended to enable Host kernel acceleration for virtio net
.
Under Virtualization:
--- 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 /etc/portage/make.conf
:
USE="$USE usbredir"
This will enable good mouse support for QEMU on your desktop.
Now, emerge qemu:
root # emerge qemu
Initial Setup
Prior to using KVM, modprobe the appropriate accelerated driver for Intel or AMD:
root # modprobe kvm_intel
Alternatively you can edit /etc/conf.d/modules to load it automatically
Next Steps
Before using KVM, be sure that your user account is in the kvm
group. You will need to use a command such as vigr
or gpasswd -a $USER kvm
as root to do this, and then log out and log back in for this to take effect.
Atm the group kvm
has no access to /dev/kvm. Change this with
root # chown root:kvm /dev/kvm root # chmod g+rw /dev/kvm
and kvm will start like expected (see bug FL-1626)
For information on how to use KVM with various operating systems, see: