DEV Community

Cover image for php-virt-manager: a lightweight web panel for the KVM hosts you already have
Piotr Skwarna
Piotr Skwarna

Posted on Originally published at skwarna.eu

php-virt-manager: a lightweight web panel for the KVM hosts you already have

My KVM hosts are plain Linux servers with libvirt. For years I managed them with virsh and, when I had a desktop at hand, with virt-manager. That works for one person at one machine. It stops working when a colleague needs to restart a test VM, when you want to do it from a phone, or when someone asks "can I get a VM for a week?".

The usual answers did not fit:

  • Proxmox VE is excellent, but it is a whole platform: you reinstall the host with it. My hosts already run Debian with other services on them.
  • Cockpit with cockpit-machines is light, but it manages one host at a time and has no per-machine permissions, schedules or API.
  • WebVirtCloud does a lot, but it is a Django application with several services, and on each KVM host it wants its own agent.

So I wrote php-virt-manager: a web panel that talks to libvirt and nothing else. It is PHP without a framework, ships as a single Docker image, and the KVM hosts need nothing besides libvirt (remote hosts are reached over qemu+ssh://). Version 2.4.0 came out on 28 November 2026.

The dashboard: machine table with live usage, tags, host charts

Start in two minutes

On the KVM host (or any machine that can reach its libvirt socket):

docker run -d --name php-virt-manager \
  --network host \
  --restart unless-stopped \
  -e TZ=Europe/Warsaw \
  -e HTTPS_PORT=9443 \
  -e HTTP_PORT=9080 \
  -e WS_PORT=6081 \
  -e PVM_USER=admin \
  -e PVM_PASSWORD=change-me \
  -v /var/run/libvirt:/var/run/libvirt \
  -v pvm-data:/app/data \
  -v pvm-ssl:/etc/nginx/ssl \
  ghcr.io/spidero/php-virt-manager:latest
Enter fullscreen mode Exit fullscreen mode

Then open https://<host>:9443/ and log in. Host networking is there because the VNC consoles of the machines listen on the host's 127.0.0.1; the browser console goes through an authenticated websocket proxy in the container. Without Docker there is deploy/install.sh, which sets up nginx, php-fpm, websockify and the cron timer on Debian or Ubuntu.

What you get

Machines

Everything you would do in virt-manager, from the browser: power actions, saving the state to disk, editing memory, CPU topology and vCPUs (also live), disks with I/O limits, network interfaces (libvirt network, host bridge or macvtap), UEFI with Secure Boot and TPM, host device passthrough, an XML editor for administrators, cloning, live migration to another hypervisor, snapshots with schedules and retention. Two consoles: noVNC with key combinations and "type text", and the serial console in xterm.js.

The machine page in the Graphite look, dark mode

New machines from cloud images in about a minute

Pick Ubuntu, Debian, AlmaLinux or Rocky Linux from the catalog, give it a name, an SSH key (or a saved one) and press Create. The panel copies the image, grows the disk and builds a NoCloud seed ISO. Since 2.4.0 the form also takes a static address with gateway and DNS, the sudo mode of the user, and your own #cloud-config that is merged into the panel's configuration: lists like packages and runcmd are appended, the user and the guest agent set by the panel stay.

A new machine from a cloud image with a static address and extra cloud-init

Backups of running machines

A backup is a plain directory: domain.xml, the disks and a small manifest.json. A shut off machine is copied directly. A running one keeps running: its disks get a temporary external snapshot, the frozen images are copied, and the snapshot is merged back with blockcommit --pivot. When the QEMU guest agent runs in the guest, its file systems are frozen first, so the copy is consistent rather than "like after a power cut". Backups run on demand or on a schedule with retention, and the Backups page restores them as a new machine, also when the original was deleted. The disks are read through libvirt, so this works for remote hypervisors and inside Docker.

Restoring a backup as a new machine

Import from VMware, VirtualBox and Hyper-V

Many people are moving off ESXi right now. The import page takes an OVA (memory, vCPUs, disks and UEFI are read from the OVF) or a single disk image: VMDK, VHDX, VHD, VDI, qcow2 or raw. Upload it in the browser, give a URL or point to a file already in a storage pool. Disks are converted to qcow2 by libvirt on the hypervisor. Windows guests get SATA disks and an e1000e network card so they boot before you install the virtio drivers.

The import form

People: roles, quotas, LDAP

Six roles, from read-only viewer and auditor up to admin. The interesting ones are user and localadmin: they see only the machines they own and create new ones within quotas (machines, vCPUs, memory, disk, per hypervisor). That is self-service VMs for a team without giving anyone the whole host. Accounts are local or come from LDAP / Active Directory, with the role taken from group membership on every login.

Users with roles, LDAP accounts and quotas

Knowing when something breaks

Notifications go to ntfy, Slack or Mattermost, Microsoft Teams, Discord, any JSON webhook, or e-mail: failed background tasks and schedules, a crashed machine, low free space in a storage pool or in the backup directory, a new release. Each problem is reported once and again only after it was fixed and came back. For dashboards there is metrics.php in the Prometheus format: host, machines (CPU, memory, disk and network counters, tags), storage pools, backups and jobs, so an alert like "no backup of this machine for two days" is one PromQL expression.

Notification channels

And the rest

Tags on machines with a filter in the machine table, usage history for 90 days, several hypervisors switched in the menu, a REST API with per-user tokens and an OpenAPI description, an action log, six interface languages (English, German, Norwegian, Polish, Spanish, Ukrainian) and five looks, each in a light and a dark mode.

Four of the five looks

How it compares

php-virt-manager Cockpit + machines WebVirtCloud 5.0 Proxmox VE
Runs on your existing libvirt hosts yes yes yes (agent on each host) no, it is the host OS
Installation one container or one script distribution packages Django and several services ISO installer
Several hosts in one panel yes one at a time yes yes (cluster)
Roles per machine, quotas yes no yes yes
Backups full, scheduled, of running VMs no incremental, scheduled yes (with PBS)
Import OVA/VMDK/VHDX yes no no yes (VMware import)
LDAP / AD with roles from groups yes via the host's PAM yes yes
Two-factor login not yet via the host yes yes
Notifications, Prometheus ntfy, Slack, Teams, Discord, e-mail; metrics no e-mail, webhook e-mail, webhook; metric server
REST API yes Cockpit bridge yes yes

To be fair: WebVirtCloud 5.0 (released a week before 2.4.0) has incremental backups and two-factor login, which php-virt-manager does not have yet, and Proxmox gives you clustering and HA that a panel on top of libvirt will never replace. php-virt-manager is for the case in the title: you already have KVM hosts, you want to keep them as they are, and you want a panel that is easy to run and easy to read.

What is next

On the list for the next releases: two-factor login (TOTP) and OIDC single sign-on, incremental backups with daily/weekly/monthly retention and an off-site target, protected machines, cancelling background tasks, VLANs on network interfaces and putting a host into maintenance.

The project is GPL-3.0 on GitHub: spidero/php-virt-manager. Ideas and bug reports are welcome in the issues, and if it saves you time, there is a GitHub Sponsors page.

Originally published on my blog.

Top comments (0)