INSTALL QEMU KVM On Linux (i.e. Debian/Ubuntu Like Distro)

The command zgrep CONFIG_KVM /boot/config-$(uname -r) searches for the string CONFIG_KVM within the compressed kernel configuration file for the currently running kernel.

We will check to see if we can run virtualization or virtual machine on our Linux computer.

These information below should be displayed as
CONFIG_KVM=m or CONFIG_KVM=y
CONFIG_KVM_INTEL=m or CONFIG_KVM_INTEL=y
CONFIG_KVM_AMD=m or CONFIG_KVM_AMD=y

We are using Debian Linux Distro and you can install the following packages below

sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager

Enable the libvirtd daemon on your Linux machine by running this command below:

sudo systemctl enable libvirtd.service

The above command ensures the specified service starts automatically at boot. If you don’t want to have the service run at boot, you can disable the service by changing the enable to disable

Or you can run the command below to run the libvirtd service whenever you need it:

Now you can start the libvirtd daemon by running this command:

sudo systemctl start libvirtd

If you do not see any output that means, the command is successful
But if you want to double check you can run this command below:

sudo systemctl status libvirtd.service

We are using tuned in Linux to optimize performance for virtual machine. We need tuned for virtual-guest to optimizes performance for a system running as a virtual machine. virtual-host to optimizes a system to run virtual machines (as a hypervisor).

You can manage the tuned service using the tuned-adm command-line utility.

tuned-adm list: Shows all available tuning profiles on your system.

tuned-adm active: Displays the currently active profile.

tuned-adm profile <profile-name>: Switches the system to a specified profile.

tuned-adm recommend: Recommends a profile based on your system’s hardware and current workload.

By using Tuned, administrators can easily and dynamically adjust system behavior without manually changing dozens of individual settings, which can be complex and error-prone.

Make sure you have installed tuned

sudo apt install tuned

Now run or start the tuned with this command:

sudo systemctl start tuned

Check your active profile using this command:

tuned-adm active

The balance profile is good for running virtual machine.
You ran this command below to check what other option in tuned-adm

tuned-adm list 

We are going to select virtual-host to optimize for running inside a virtual guest.

sudo tuned-adm profile virtual-host

You can check your current profile by running this command

tuned-adm active

When you’re done restart your PC to have this take effect.

After you have restart your computer, we can now configure your network bridge.

By default all virtual machine is connected to the NAT network

Type this command below to find out if the virtual machine is running on NAT network.

sudo virsh net-list --all

Type these command below to enables the automatic startup of the virtual network named default whenever the libvirt daemon starts.

sudo virsh net-start default
sudo virsh net-autostart default

Now the QEMU and KVM should be working. You can run the Virtual Machine Manager, type the command below:

virt-manager

Similar Posts