KVM: Difference between revisions

From Alpine Linux
No edit summary
No edit summary
Line 5: Line 5:
It is possible to install just qemu and libvirt for local management, but most users will probably want libvirt-deamon and/or virt-manager for a GUI.  
It is possible to install just qemu and libvirt for local management, but most users will probably want libvirt-deamon and/or virt-manager for a GUI.  
{{Cmd|sudo apk add qemu-system-x86_64 libvirt  
{{Cmd|sudo apk add qemu-system-x86_64 libvirt  
sudo apk add libvirt-daemon dbus}}
sudo apk add libvirt-daemon dbus polkit}}


Enable the KVM kernel module
Enable the KVM kernel module
Line 18: Line 18:
sudo addgroup user libvirt}}
sudo addgroup user libvirt}}


Set libvirtd and dbus to start on startup
{{Cmd|sudo rc-update add libvirtd
sudo rc-update add dbus}}
== Configure PolicyKit ==
In order to use libvirtd to remotely control KVM over ssh PolicyKit needs a .pkla informing it that this is allowed.
Write the following file to /etc/polkit-1/localauthority/50-local.d/50-libvirt-ssh-remote-access-policy.pkla
{{Cmd|<nowiki>[Remote libvirt SSH access]
Identity=unix-group:libvirt
Action=org.libvirt.unix.manage
ResultAny=yes
ResultInactive=yes
ResultActive=yes</nowiki>
}}


[[Category:Virtualization]]
[[Category:Virtualization]]

Revision as of 20:37, 28 July 2017

KVM is an open source virtualization solution in a kernel module. KVM can virtualize x86, PowerPC, and S390 guests.


Installing KVM

It is possible to install just qemu and libvirt for local management, but most users will probably want libvirt-deamon and/or virt-manager for a GUI.

sudo apk add qemu-system-x86_64 libvirt sudo apk add libvirt-daemon dbus polkit

Enable the KVM kernel module

sudo modprobe kvm-intel

or

sudo modprobe kvm-amd


Add your user to the follwing groups so you can mange the vms

sudo addgroup user kvm sudo addgroup user qemu sudo addgroup user libvirt

Set libvirtd and dbus to start on startup

sudo rc-update add libvirtd sudo rc-update add dbus

Configure PolicyKit

In order to use libvirtd to remotely control KVM over ssh PolicyKit needs a .pkla informing it that this is allowed. Write the following file to /etc/polkit-1/localauthority/50-local.d/50-libvirt-ssh-remote-access-policy.pkla

[Remote libvirt SSH access] Identity=unix-group:libvirt Action=org.libvirt.unix.manage ResultAny=yes ResultInactive=yes ResultActive=yes