Bengaluru Tech Summit 2024 on November 19-21 in India
Go back

Configuration of KVM hypervisor on Linux Using Ubuntu as Example

September 20, 2024
Alexey Arkatov

Alexey Arkatov

TrueConf Server can be deployed on a virtual machine (VM). However, this is a very complex task and we do not recommend this procedure to inexperienced users: correct configuration of a virtual machine may sometimes be very difficult.

This guide will describe the configuration of the KVM hypervisor (Kernel-based Virtual Machine). We will take the example of the server running on Ubuntu 22.04 LTS. However, the instructions provided below may be helpful if any Linux distribution is used since KVM is a part of the kernel.

Below we will show how to use KVM with the help of the terminal and on Linux with a graphical shell.

Updating packages

Before starting, update packages by running the command:

How to check if KVM is supported

The KVM module is a hardware-based virtualization tool based on Intel VT or AMD SVM; so, this method cannot be used on CPUs that do not support this technology.

Run this command in the terminal to check if hardware-based virtualization is supported:

In this case the program displays 4. If the result displayed by the program is larger than 0, hardware-based virtualization is supported. Here, the result is equal to 4.

KVM configuration

KVM installation

Run this command to install the packages needed for virtualization:

If you are using Linux that supports the graphical shell, you can also install the virt-manager utility which will provide you with a graphic user interface (GUI) for managing virtual machines.

After installing KVM, you can start its configuration.

How to enable virtualization

Run the Libvirt service with these commands:

After launching the service, restart the computer and check the status of the Libvirt service by running the command:

Adding a user to KVM and Libvirt groups

To make sure that the OS account you are using was allowed to create and manage virtual machines, this account should be added to KVM and Libvirt groups. For this purpose, execute these commands:

Creation of a network bridge

If you are intending to access the virtual machine from outside the network, then it is necessary to create a network bridge for this machine.

We will show how one can connect to a virtual machine via an Ethernet port of the host. Let us suppose that the port is connected to the router that distributes IPv4 addresses via DHCP and the VM will receive an IP address in the same way. Please note that the configuration of the yaml file on your PC may differ from the example below. So, we recommend checking the documentation.

  1. Get the list of network interfaces in the host OS:
  2. For example, the following result is displayed:

  3. Select the required interface, for example, enp1s0.
  4. In the directory /etc/netplan create the file 01-netcfg.yaml with the following text:
  5. To create a file with the help of the terminal, you may use this command:

    To apply changes, execute the command:

    After applying changes, run the following command to check if the network bridge has been added:

    Make sure that the network interface br0 is included in the list.

    Working with virtual machines

    How to create a virtual machine with the help of the terminal

    To create a virtual machine, run this command:

    где:

    • --name [virtual machine name] — the virtual machine name;
    • --vcpu [number of allocated threads] — allocation of CPU threads;
    • --memory [amount of allocated RAM in MB] — allocation of RAM, size in MB;
    • --network [network interface] — the type of network interface;
    • --boot [boot device priority] — the order of boot devices for the virtual machine, boot devices;
    • --disk [virtual disk location, size in GB] — virtual disk emulation, location, size in GB;
    • --cdrom [path to CD-ROM] — CD-ROM emulation, path to its contents.

    Example of a full command:

    To check if the virtual machine has been created, execute the command:

    The list of all virtual machines will be displayed in the terminal:

    Creating a virtual machine in a manager with GUI

    Find the manager of virtual machines in the list applications and run it:

    Configuration of KVM hypervisor on Linux Using Ubuntu as Example 1

    To create a virtual machine, click on File → Create a virtual machine and take the following steps:

    1. Select the way of installing the operating system, for example, from an ISO image:
    2. Configuration of KVM hypervisor on Linux Using Ubuntu as Example 2

    3. Select the file of the operating system image:
    4. Configuration of KVM hypervisor on Linux Using Ubuntu as Example 3

    5. Specify the required size of RAM and the number of virtual cores (vCPUs) for the VM:
    6. Configuration of KVM hypervisor on Linux Using Ubuntu as Example 4

    7. Configure data storage space. Please note that if you select the option Create a disk image for this virtual machine, the disk will be created in the root directory. To create a storage in the required directory select the option Select or create custom settings and click Manage.
    8. Configuration of KVM hypervisor on Linux Using Ubuntu as Example 5

    9. Create a data pool and add a volume in this pool for the virtual machine:
    10. Configuration of KVM hypervisor on Linux Using Ubuntu as Example 6

      1. Add a pool by following instructions in the manager.
      2. Add a volume by following instructions in the manager.
    11. Test the configuration of the virtual machine. It is important to select the correct network. In this case, we are referring to the network bridge br0 created with the help of the yaml file.
    12. Configuration of KVM hypervisor on Linux Using Ubuntu as Example 7>

    When the test is complete, click Finish. A pop-up window will open; here you can view the configuration of the virtual machine.

    Configuration of KVM hypervisor on Linux Using Ubuntu as Example 8

    After testing the current configuration, click Start installation.

    Launch of the virtual machine

    As a next step, run the virtual machine and install the operating system (in our case Debian 12) on it.

    Using a virtual machine with the help of the terminal

    To launch the virtual machine, run the command:

    To check if the machine is running, execute the command:

    To display the virtual machine, run the command:

    Using a GUI manager to control the virtual machine

    To run the VM in the manager window, right-click on the configured virtual machine and select the Start option.

    Configuration of KVM hypervisor on Linux Using Ubuntu as Example 9

    Install the OS, by following the instructions in the VM window.

    Configuration of KVM hypervisor on Linux Using Ubuntu as Example 10

    TrueConf Server installation

    Now everything is ready for the installation of TrueConf Server on the virtual machine, in particular:

    • We have made sure that hardware-based virtualization is supported;
    • The network bridge for the virtual machine has been created;
    • The virtual machine has been configured.

    Install TrueConf Server as it is shown in our guide. After installation, you can add user accounts, configure HTTPS and other TrueConf Server parameters. If you have any questions, please contact our technical support.


Still have questions? Please contact our support team directly via online chat.

Sign up for newsletter