Table of Contents
In this article I will share step by step instructions with screenshots to create KVM virtual machine using virt-manager (Virtual Machine Manager) in RHEL/CentOS 7/8
⇒ Cockpit Web Console GUI
⇒ virt-install Command Line Tool
You can use the following GUIs to manage virtualization in RHEL/CentOS 8:
- The RHEL/CentOS 8 web console, also known as Cockpit, provides a remotely accessible and easy to use graphical user interface for managing VMs and virtualization hosts.
- The Virtual Machine Manager (
virt-manager) application provides a specialised GUI for managing VMs and virtualization hosts.
As a pre-requisite, you must first install KVM and enable KVM Virtualization on your Linux server host before you can create KVM Virtual Machine using
virt-manager or any other method in RHEL/CentOS 8 Linux
Overview on Virtual Manager
virt-managerapplication is a Python-based desktop user interface for managing virtual machines through
- It primarily targets KVM VMs, but also manages Xen and LXC (Linux containers) among others.
virt-managerdisplays a summary view of running VMs, supplying their performance and resource utilization statistics.
- Using the
virt-managergraphical interface, one can easily create new VMs, monitor them, and make configuration changes when required.
Virtual Machine Manager is not installed by default. Although if you have installed your Linux server using "Virtualization" then Virtual Machine Manager will be installed by default
To install virt-manager you can use DNF or YUM. I hope you are aware of DNF which is an alternative of YUM
[root@rhel-8 ~]# dnf install -y virt-manager
Login to you graphical console
virt-manager from the terminal as root user (if you are using normal user, then the command will prompt for root password)
Click on Edit → Connection Details
Click on Edit → Virtual Networks
By default once you install Virtualization related package, a bridge interface virbr0 with NAT is created on the Linux server. This will be visible under "Virtual Networks" TAB
The same virtual network can also be checked using nmcli command
[root@rhel-8 ~]# nmcli con show --active NAME UUID TYPE DEVICE br0 4a38747e-49f4-4213-83cb-a946d3dffefb bridge nm-bridge virbr0 3169c22f-6e1b-47df-9e07-6a4318e720b3 bridge virbr0 slave1 eb862842-ba6a-47fe-994c-733977a8275b ethernet eno49 slave2 631e5c3e-bf2f-46d3-b9dd-dca2001f586b ethernet eno50 vnet0 3d1aacbe-0e20-45b6-8305-000525f28bfa tun vnet0 vnet1 c8b0cc12-d9cf-4c56-a9e1-b300b714738f tun vnet1 vnet2 4506cb41-4333-4ac8-a116-4f50a24bfec8 tun vnet2 vnet3 9cd7bcd6-cc53-447a-aaa9-009fbed0d322 tun vnet3
Using the Virtual Networks tab you will be able to configure the following types of virtual network:
- The default network is a NAT-based virtual network.
- It allows virtual machines to communicate with the outside networks irrespective of the active network interface (Ethernet, wireless, VPN, and so on) available on the hypervisor.
- It also provides a private network with IP and a DHCP server so that the VMs will get their IP addresses automatically.
- Virtual network configuration files are stored in
/etc/libvirt/qemu/networks/as XML files.
- For the default network it is
[root@rhel-8 ~]# virsh net-info default Name: default UUID: 836520d9-fb0a-46f0-8745-033353151e93 Active: yes Persistent: yes Autostart: yes Bridge: virbr0
- The Storage tab provides details of the storage pools available.
- A storage pool is just a store for saved virtual machine disk images.
- At the time of writing,
libvirtsupports creating storage pools from the different types of source shown in the following screenshot; directory and LVM are the most commonly used.
- Default storage pool: Default is the name of file-based storage pool that
libvirtcreated to store its virtual machine image file. The location of this storage pool is in
Create KVM Virtual Machine using virt-manager
The following methods are available with virt-manager for Guest OS installation:
- Local installation media (ISO Image or CD-ROM)
- Network installation (HTTP, FTP, or NFS)
- Network boot (PXE)
- Importing existing disk images
Create new Virtual Machine
From Virtual Machine Manager, click on File → New Virtual Machine to Create to open the wizard to create KVM Virtual Machine using virt-manager
The wizard breaks down the virtual machine creation process into five steps:
- Choosing the installation method.
- Configuring the installation media.
- Memory and CPU configuration.
- Virtual machine storage configuration.
- Naming the Guest OS and networking configuration.
Select Installation Media
Select Local install media (ISO Image or CDROM) and click on the Forward button.
Clicking on the Forward button will take you to Step 2 where you have to specify the ISO image location.
Select your ISO which you plan to use to create KVM Virtual Machine using
virt-manager automatically detects the operating system based on the install media. It uses the OS information database provided by
At the time of writing this article, CentOS 8 was not part of Virtual Manager
Un-check the option to "automatically detect from the installation media/source" if the Virtual Manager fails to get the source information and choose Generic (default)
Define CPU and Memory for VM
On the next screen, specify the memory and CPU that you want allocate for the virtual machine:
Define Storage for VM
- The wizard shows the maximum amount of CPUs and memory you can allocate. Configure these settings and click Forward to configure storage for the virtual machine:
- Make sure you assign sufficient space for your virtual machine.
- By default, it creates a virtual disk at the
/var/lib/libvirt/qemulocation, which is the default pool.
- If there are any other custom storage pools defined on the system, select create custom storage and either directly enter the path of the disk or click on the Manage button, which will open the Locate or create storage volume dialog box where you can select an existing volume or create a new one from the defined storage pool, if any available.
Assign Guest VM Name and Configure Network
- The next and final step is naming the guest and networking configuration.
- The default machine name is based on the selected OS. But since I am using generic Default, the name is not populated automatically. I will change it to vm_1.
- You can change it to whatever name you want to give but note that only underscores (_), periods (.), and hyphens (-) are supported:
If you wish to further configure the virtual machine's hardware first, check the Customize configuration before install box first before clicking Finish. Or you can click on the bulb icon (as shown below) to open the configuration wizard for respective VM
Access and Modify VM Configuration
Below is a sample screenshot of VM Setting's section
Create VM Snapshot in Virtual manager
- You can also create snapshots in Virtual Manager.
- Select the VM for which you wish to create snapshot
- Click on Snapshot icon. Follow the below screenshot
- Click on + sign to take snapshot of the current state of the VM
Lastly I hope the steps from the article to create KVM Virtual Machine using Virtual Manager on Linux was helpful. So, let me know your suggestions and feedback using the comment section.
Create KVM Virtual Machine using Virtual Manager