How to install Virt-Manager Complete Edition
Since its introduction virtualization has come a long way. Nowadays hypervisors are used for almost everything from running enterprise-level servers to testing different operating systems on a local user computer. There are many paid and free hypervisor solutions available in the world.
But in this guide, we are looking at installing one of these best free toolsets used for virtualization and it consists of Virt-Manager, KVM, and QEMU. This guide will show you how to install these tools correctly and with less hassle. Before starting let’s get to know this software a bit better.
What is Virt-Manager?
Virt-Manager is a graphical user front end for the library which provides virtual machine management services. The Virt-manager interface makes it easy for the user to create, delete and manipulate virtual machines without going through the terminal.
Virt-manager mainly supports KVM but it can also work with other hypervisors such as Xen and LXC.
When virt-manager is installed it comes with the below-listed tool-set.
- virt-install: Command-line utility to provision OS
- virt-viewer: The UI interface with graphical features
- virt-clone: Command-line tool to clone existing inactive hosts
- virt-xml: Command-line tool for easily editing libvirt domain XML using virt-install’s command-line options.
- virt-bootstrap: Command tool providing an easy way to set up the root file system for libvirt-based containers.
The letters KVM stands for Kernel-based Virtual Machines. KVM is a Linux full virtualization solution for x86 architecture processors which has the virtualization extension (Intel VT and AMD-V).
KVM is a free (as free beer) and open-source software. The support for KVM is included in all the new Linux kernels by design.
QEMU is the shortened version of Quick EMUlator which is a free open-source emulator that can perform hardware virtualization. It emulates the host machine processor through dynamic binary translation. This provides different sets of hardware and device models for the host machine, which enables it to run a variety of guest systems.
KVM can be used with QEMU which allows virtual machines to be run nearly to native speeds. Not just hardware emulation, QEMU is capable of emulating user-level processors which enable applications compiled for one architecture to run on another.
1. Installing all the packages to run virt-manager.
sudo pacman -Syu virt-manager qemu-desktop dnsmasq iptables-nft
sudo pacman -Syu --needed virt-manager qemu-desktop libvirt edk2-ovmf dnsmasq vde2 bridge-utils iptables-nft dmidecode
- edk2-ovmf: ovmf is an EDK II based project to enable UEFI support for Virtual Machines.
- iptables-nft: Linux kernel packet control tool (using nft interface).
- bridge-utils: Ethernet bridge utilities.
2. After installation completes you need to enable libvirtd service, if you need
LXC to be available, for qemu session this is not needed!
sudo systemctl enable --now libvirtd.service
3. Check for the status to make sure the service is running.
systemctl status libvirtd.service
Now you will be able to start creating your VM setup over the application.
QEMU connection does not require
Run Virt-Manager as normal user (recommended):
1. Create kvm and libvirt groups if not present
sudo groupadd -f kvm
sudo groupadd -f libvirt
2. Add current user to kvm and libvirt groups
sudo usermod -aG libvirt yourusername
sudo usermod -aG kvm yourusername
3. Add these two lines at the end of /etc/libvirt/libvirtd.conf
unix_sock_group = "libvirt"
unix_sock_ro_perms = "0777"
unix_sock_rw_perms = "0770"
4. Add these two lines at the end of /etc/libvirt/qemu.conf
swtpm_user = "swtpm"
swtpm_group = "swtpm"
user = "yourusername"
group = "yourusername"
replace yourusername with your actual real username please 😉
Now reboot the system to make sure the changes are applied or at least fully logout your user by logout and back in to the Desktop.
5. To finish the setup the last step is to replace the default qemu session handler with the user qemu session manager:
Open virt-manager from application menu. Delete the default QEMU/KVM System/Root Session” connection
And add a new one using QEMU/KVM User Session:
File > Add Connection > Hypervisor: “QEMU/KVM User Session” > Autoconnect > “Enable”
Now you can start virt-manager and create virtual machines as a non-root user!
Package for extra functionality:
- qemu-arch-extra – extra architectures support
- qemu-block-gluster – Glusterfs block support
- qemu-block-iscsi – iSCSI block support
- qemu-block-rbd – RBD block support
If Network is disabled after rebooting the host machine and you do not find a way to enable it, you can have it enabled per default from the command line. This will work after rebooting the host:
sudo virsh net-autostart default
If you wish to edit the created virtual machine disk images you can install libguestfs. These are set of tools that allow the user to view and edit files inside guest systems, change VM script changes, monitor disk space, create new guests, P2V, V2V, perform backups, clone VMs, and much more.
yay -S libguestfs
All QEMU user mode and system emulators
yay -S qemu-emulators-full
Glusterfs is a scalable network filesystem. This adds Glusterfs block support to QEMU.
yay -S qemu-block-gluster
iSCI enables storage access via a network.
qemu-block-iscsi enables QEMU to block this.
yay -S qemu-block-iscsi
This would add support to SMB/CIFS support to QEMU.
yay -S samba
Enabling virtio graphics with 3D acceleration
There are several graphical accelerations modes supported by virt-manager.
- QXL – QXL paravirtual graphic card. It is VGA compatible (including VESA 2.0 VBE support). Works best with QXL guest drivers installed though. Recommended choice when using the spice-protocol.
- Bochs – The Bochs VGA BIOS supports, to an extent, the VBE specification.
- Ramfb – A simple frame buffer that lives in guest RAM and is configured via fw_cfg.
- VGA – Standard VGA card
- Virtio – Virtio-gpu is a paravirtualized 3d accelerated graphics driver.
When using virtio with 3D acceleration sometimes virt-manager doesn’t work and it throws an error. It’s actually is not virt-manager it’s qemu that’s crashing.
To use virtio with 3D acceleration, you need to configure virt-manager as shown below.
NOTE: At the time of writing there is an issue when using virtio with 3D acceleration with XFCE DE which leads to guests being a black screen. It is caused by the default xfwm4+compositing compositor. The known workaround is to use ‘QXL’ or virtio without 3D acceleration.
- Go to Display Spice and check the Open GL check box and select Auto from the drop-down.
2. Now go to Video and select virtio then check the 3D Acceleration checkbox.
After configuring like this you can enjoy a fully 3D accelerated guest VM. Also, remember to click on Apply.
Installing virtio guest drivers for Windows
RedHat supplies a set of guest drivers for virtio which covers the graphic drivers for the guest system. You can download the latest drivers from their GitHub virtio-win-pkg-scripts page here.
Throughout this article, we have covered most of the aspects of how to install and configure virt-manager and KVM. Hope this article helped you to get your own virtual environment up and running. If there are any questions feel free to reach us at the forums or any other contact channel listed below.Connect with us: