This article describes what is Virt-manager application and how to manage KVM virtual machines with Virt-manager in Linux operating systems.
1. What is Virt-manager?
Virt-manager, short for Virtual Machine Manager, is a graphical user interface application used for managing virtual machines through
libvirt. To put this in other words, Virt-manager is a graphical front-end for
Even though it is mainly created for KVM guests, it also can manage XEN and LXC containers as well. It has an embedded VNC and SPICE client viewer application to view the full screen console of a running VM.
The virt-manager application is useful for managing KVM guests hosted in Linux systems that have graphical desktop environments.
Virtual Machine Manager allows the users to:
- create, edit, start, suspend, resume and stop VMs,
- view and control each VM's console,
- view all running VMs and hosts,
- view the performance and utilization statistics of each VM,
- view the live performance and resource utilization statistics of VMs and hosts,
- manage KVM, Xen or QEMU virtual machines, running either locally or remotely,
- manage LXC containers etc.
Virt-manager is written in Python and developed by Red Hat.
2. Install Virt-Manager in Linux
I assume you already have installed KVM on your Linux system. I you haven't installed it. Refer the following guides:
- Install And Configure KVM In CentOS 8 Server
- Install And Configure KVM In Ubuntu 20.04 Headless Server
- Install And Configure KVM In OpenSUSE Tumbleweed
Now let us install Virt-manager. Virt-manager has been packaged for many popular Linux distros.
On Arch Linux and its variants like Manjaro Linux, run the following command to install Virt-manager:
$ sudo pacman -S virt-manager
On Debian, Ubuntu:
$ sudo apt install virt-manager
In Ubuntu make sure you have enabled the
On RHEL, CentOS, Fedora:
$ sudo dnf install virt-manager
$ sudo zypper install virt-manager
In addition to Virt-manager, the following supporting tools will also be installed as well:
- virt-install - a command line tool to provision new virtual machines. It creates a new KVM, Xen, or Linux container guests from command line using the
libvirhypervisor management library.
- virt-viewer - a lightweight UI interface to view and interact with the graphical display of virtualized guest OS. It can display VNC or SPICE, and uses
libvirtto lookup the graphical connection details.
- virt-clone - a command line tool used to clone existing inactive guests. It copies the disk images, and defines a config with new name, UUID and MAC address pointing to the copied disks.
- virt-xml - a command line tool to edit
- virt-convert - a command line tool to convert OVF and VMX VM configurations to run with libvirt.
- virt-bootstrap - a command tool providing an easy way to setup the root file system for libvirt-based containers.
2.1. Start and enable libvirtd service
libvirtd service is enabled and running using command:
$ sudo systemctl status libvirtd
If it is not started, run the following commands to enable and start
$ sudo systemctl enable libvirtd
$ sudo systemctl start libvirtd
2.2. Add user to libvirt group
Every time you launch Virt-manager, you will be asked to enter the
sudo password of your user. To avoid this, add your user to the
libvirt group using command:
$ sudo usermod -a -G libvirt $(whoami)
Log out and log back in to apply the changes.
3. Manage KVM Virtual Machines With Virt-Manager
Once Virt-manager is installed, launch it from Dash or menu. The default interface of Virt-manager should look like below:
Managing KVM guests with Virt-manager is very easier than you think. Let me show you basic Kvm management tasks with screenshots.
3.1. Create a new virtual machine
Go to File -> New Virtual Machine from Virt-manager main window. Choose how would you like to install the guest OS. You will be given four choices as listed below:
- Local install media (E.g. ISO or CDROM),
- Network install such as HTTP, HTTPS, or FTP,
- Network Boot (E.g. PXE),
- Import existing disk image.
I go with "Local install media" option. Click Forward to continue:
Choose the ISO file location of the OS. If you have the physical CD/DVD medium, choose it instead. You operating system type will automatically be selected depending on the installation medium you choose.
If Virt-manager can't detect the OS type, uncheck the option that says "Automatically detect from the installation media / source" and select "Generic default" as your OS type.
Here, I've selected POP_OS! 20.04 ISO file, but Virt-manager could not detect the OS type, so I chose Generic default.
Choose memory size and number of cores for virtual CPU:
Choose the disk size for the Kvm guest:
Enter the name for your Kvm guest. The name should not contain any blank spaces. Click Finish to create the virtual machine.
Once the Virtual machine is created, you will be automatically taken to the virtual machine's graphical console window.
Continue the guest OS installation as usual.
3.2. Switch between normal mode and full screen screen mode
By default, the guest will start in normal window mode. You can toggle to full screen mode by clicking on the "Switch to full screen view" button on the top right side of console window.
To go back to normal window, move the mouse cursor to the top middle side (over the date and time of VM) and you will see "Leave full screen" option, just click on it to switch to normal window.
3.3. View all running kvm guests and their resource usage
The Virt-manager main window shows all running kvm guests and resource utilization by the guests.
From here, you can start, pause, save the current state of a VM, restart and shutdown VMs.
3.4. View Kvm virtual machine details
The virtual hardware details window shows the information about all hardware resources configured to the kvm guest.
In this window, you can,
- view running guest OS details,
- view the Hypervisor details,
- view guest operating system's type,
- view resource utilization by cpu, memory, disk and network,
- view number of vCPUs,
- view allocated memory size,
- view boot options,
- view virtual disk and cdrom details,
- view network settings,
- view keyboard and mouse settings,
- view display card details,
- view sound card details,
- view information of all other hardware attached to the guest machine,
- add a new virtual hardware,
- modify the parameters of a virtual hardware,
- remove virtual hardware etc.
3.5. Add a virtual hardware
Open Virtual hardware details window and click "Add Hardware" button at the bottom.
Choose the hardware type you want to add from the left pane and pick a device from the list to attach to the guest machine.
3.6. View Kvm host and guest CPU usage
From Virt-manager main window, we can view the all guest machines' cpu usage by default. To view the KVM host's CPU usage, go to View -> Graph and select "Host CPU Usage" option.
3.7. Clone Kvm guests
Virt-manager allows us to clone the existing virtual machines. First make sure the guest machine is switched off. Right click on the guest machine and choose "Clone" from the menu.
It creates a new independent copy of the original virtual disk and defines a config with new name, UUID and MAC address pointing to the copied disks.
3.8. View Disk I/O, Network I/O, Memory stats
By default, Virt-manager will only shows the CPU usage. If you want to view the statistics of Disk I/O, Network I/O and Memory, you must enable them from Virt-manager main window.
Go to View -> Preferences and check those options to enable them.
Then go to View -> Graph and select Memory Usage, Disk I/O and Network I/O. Now you will see these statistics from the Virt-manager main window.
In this guide, we discussed how to install and manage KVM virtual machines using Virt-manager graphical application. Deploying and managing VMs using Virt-manager is not only easy but also fast.
Virt-manager is poor man's Vmware ESXi server and a great replacement for other standalone virtualization applications like Oracle VirtualBox and Vmware workstation.
Since Virt-manager is from Red Hat, we can get consistent updates and bug fixes. If you have sufficient hardware, you could setup a perfect server virtualization environment for your organization using Virt-manager without much hassle.
Other KVM related guides on this blog
- Manage KVM Virtual Machines Using Cockpit Web Console
- Manage KVM Virtual Machines With Virsh Program
- Create A KVM Virtual Machine Using Qcow2 Image In Linux
- How To Migrate Virtualbox VMs Into KVM VMs In Linux
- How To Use Vagrant With Libvirt KVM Provider
- Enable UEFI Support For KVM Virtual Machines In Linux
- How To Enable Nested Virtualization In KVM In Linux
- Display Virtualization Systems Stats With Virt-top In Linux
- How To Find The IP Address Of A KVM Virtual Machine
- How To Rename KVM Guest Virtual Machine
- Access And Modify Virtual Machine Disk Images With Libguestfs
- Quickly Build Virtual Machine Images With Virt-builder
- How To Rescue Virtual Machines With Virt-rescue
- How To Extend KVM Virtual Machine Disk Size In Linux
- Setup A Shared Folder Between KVM Host And Guest
- How To Change KVM Libvirt Default Storage Pool Location
- [Solved] Cannot access storage file, Permission denied Error in KVM Libvirt