Cleaned up by joekamprad 10 nov. 2022
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 toolset.
- 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 -S virt-manager libvirt qemu-base
sudo pacman -S --needed virt-manager qemu-base 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.
sudo systemctl enable --now libvirtd.service
3. Check for the status to make sure the service is running.
systemctl status libvirtd.service
The output should look something like below.
○ libvirtd. service - Virtualization daemon Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: disabled) Active: inactive (dead) since Tue 2021-08-31 20:33:58 +0530; 1h 14min ago TriggeredBy: ● libvirtd-admin.socket ● libvirtd-ro.socket ● libvirtd.socket Docs: man:libvirtd(8) https://libvirt.org Process: 21412 ExecStart=/usr/bin/libvirtd $LIBVIRTD_ARGS (code=exited, status=0/SUCCESS) Main PID: 21412 (code=exited, status=0/SUCCESS) Tasks: 2 (limit: 32768) Memory: 18.5M CPU: 423ms CGroup: /system.slice/libvirtd.service ├─982 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper └─983 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
Now you will be able to start creating your VM setup over the application.
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: