Alpine KVM

Table of Contents

Setup libvirt/KVM on a remote Alpine Linux server and connect virsh/virt-manager from remote.

Alpine server is assumed to have no GUI capability. All steps are done through remote connection.

Install KVM


  • This part is a streamline version of Alpine KVM wiki page.
  • No virt-manager on remote Alpine server. You only need it on your local machine.
  • Assume VMs bridge-mode using macvtap. bridge package not required.
  • Use root or sudo for all commands in this section.

Add KVM packages:

apk add libvirt-daemon qemu-img qemu-system-x86_64 polkit
rc-update add libvirtd

Add user to group libvirt:

addgroup <user> libvirt

Allow libvirt group to access /var/run/libvirt/libvirt-sock:

mkdir -p /etc/polkit-1/localauthority/50-local.d

Create /etc/polkit-1/localauthority/50-local.d/50-libvirt-ssh-remote-access-policy.pkla with following content:

[Remote libvirt SSH access]

At this point virt-manager and virsh can connect from remote and takeover completely.

Remote Management

virsh and virt-manager can be used to manage KVM remotely.

virsh is the command line tool that can manage libvirt/KVM directly on the host or from remote.

virt-manager is the gui interface.

Local connection (on Alpine server)

From libvirt group user:

Interactive mode:

virsh -c qemu:///system

Command line / batch mode

virsh -c qemu:///system net-list --all

Remote connection

NOTE: user@hostname will be the same string for ssh to the libvirt group user on Alpine host. SSH key should be setup already.


virt-manager -c qemu+ssh://user@hostname/system

virsh -c qemu+ssh://user@hostname/system

virsh -c qemu+ssh://user@hostname/system net-list --all


Check out MacOS Connect to KVM Client Desktop for running virt-manager to remote manage and connect KVM on MacOS.

John Siu
Minimize the Effort, Maximize the Effect!
comments powered by Disqus