Skip to content
Log In Sign Up info@muvcloud.com

Step 1: Check the Processor

KVM needs the processor's virtualization extensions, Intel VT-x (flag vmx) or AMD-V (flag svm):

grep -Ec '(vmx|svm)' /proc/cpuinfo

A number above 0 means the flag is present. Ubuntu's kvm-ok tool gives a plainer answer:

sudo apt install cpu-checker
kvm-ok

It reports whether KVM acceleration can be used. On a dedicated server where the answer is no, enable the extensions in the firmware setup through the remote console.

KVM Inside a VPS

This guide is meant for a dedicated (bare-metal) server. A VPS is already a virtual machine; running KVM inside it needs nested virtualization, which is usually unavailable, and where it is available the inner machines are noticeably slower. If the check above prints 0 on a VPS, that is the reason. For isolated applications on a VPS, containers are the usual alternative, as in how to install Docker on Ubuntu.

Step 2: Install the Packages

sudo apt update
sudo apt install qemu-system-x86 libvirt-daemon-system libvirt-clients virtinst

The same package names install on Ubuntu 24.04 and 26.04:

  • qemu-system-x86: QEMU for x86 servers, which runs the virtual machines with KVM acceleration. Ubuntu's documentation writes qemu-kvm for the same software.
  • libvirt-daemon-system: the libvirt service that manages machines, networks, and storage.
  • libvirt-clients: the virsh command.
  • virtinst: the virt-install command; on 26.04 the package itself is named virt-install, and virtinst pulls it in.

libvirt runs either as one daemon, libvirtd, or as separate per-driver daemons such as virtqemud, which start on demand through systemd sockets; virsh works the same either way. Check with systemctl status libvirtd or systemctl status virtqemud.

Step 3: Give Your User Access

sudo usermod -aG libvirt $USER

Log out and back in for the group to apply; group changes are covered in how to add a user to a group in Linux. As a normal user, virsh may connect to a per-user session instead of the system's machines. Point it at the system instance:

export LIBVIRT_DEFAULT_URI=qemu:///system
virsh list --all

An empty table means the connection works and no machines exist yet. Add the export line to ~/.bashrc to keep it.

Step 4: Create a Virtual Machine

Copy an installation ISO to /var/lib/libvirt/images/, then run:

virt-install \
  --name vm1 \
  --memory 2048 \
  --vcpus 2 \
  --disk size=20 \
  --cdrom /var/lib/libvirt/images/INSTALLER.iso \
  --os-variant OS_VARIANT \
  --network network=default \
  --graphics vnc,listen=127.0.0.1

Replace INSTALLER.iso with the file name and OS_VARIANT with the matching name from virt-install --osinfo list. --memory is in MiB and size in GiB; the disk file is created in libvirt's default image location. Find the console display with virsh vncdisplay vm1, then reach it from your computer through an SSH tunnel, as in SSH port forwarding, and a VNC viewer; the console listens only on the server itself.

Step 5: Manage Machines with virsh

CommandWhat it does
virsh list --allLists all machines
virsh start vm1Starts a machine
virsh shutdown vm1Asks the guest to shut down
virsh reboot vm1Asks the guest to reboot
virsh destroy vm1Cuts power at once
virsh autostart vm1Starts it at host boot
virsh dominfo vm1Shows its settings

Use shutdown first; destroy is the same as pulling the power cord and does not delete the machine. Deleting is virsh undefine, which removes the definition but leaves the disk file in place unless you add a storage option such as --remove-all-storage.

The Default Network and Bridges

libvirt creates a NAT network named default on the bridge virbr0, usually in 192.168.122.0/24. Guests reach the internet through the host but cannot be reached from outside. Check it with virsh net-list --all.

To give guests public IPs, create a bridge on the host's network card with netplan and attach guests with --network bridge=br0. Moving the host's IP to a bridge can cut your connection, so do it with the remote console open, and ask your provider how additional IPs and their MAC addresses must be set up. For a web interface on top of KVM, see how to install Proxmox VE; background is in what is KVM virtualization.

Updated:

Linux VPS with Full Root Access

MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.

Cloud VPS Plans Starting at2.99 $/mo Cheap Linux VPS

No Limits on Service or Support

You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

Support specialist
  • 100% customer satisfaction goal
  • Our own hardware
  • 24/7 ticket and email support
  • 4 countries with locations