How to Install KVM on Debian Latest

KVM (Kernel-based Virtual Machine) is an open source virtualization technology that allows you to run multiple virtual machines on a Linux machine.

In this tutorial, we will show you how to install KVM on Debian Latest.

Prerequisites

Before you get started, make sure you have the following prerequisites:

Step 1: Update the System

It is recommended to update your system before starting the installation of KVM.

sudo apt update
sudo apt upgrade

Step 2: Install KVM

To install KVM, run the following command:

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

This command will install all the necessary packages for KVM.

Step 3: Verify KVM Installation

After the installation is complete, verify that KVM is installed correctly by running the following command:

sudo systemctl status libvirtd

You should see an output similar to the following:

● libvirtd.service - Virtualization daemon
   Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-06-18 10:52:32 UTC; 16s ago

Step 4: Configure Networking

KVM requires a bridge interface to be set up in order to provide networking to virtual machines.

To configure a bridge interface, edit the /etc/network/interfaces file:

sudo nano /etc/network/interfaces

Add the following lines at the end of the file:

auto br0
iface br0 inet dhcp
    bridge_ports enp0s3

Replace enp0s3 with the name of the network interface connected to the internet.

Save the file and restart the networking service:

sudo systemctl restart networking

Step 5: Create a Virtual Machine

Now that KVM is installed and networking is configured, you can create a virtual machine using the virt-install command.

For example, to create a virtual machine with 2GB of RAM, 20GB hard disk, and the Debian Latest ISO image, run the following command:

sudo virt-install --name vmname --ram 2048 --disk size=20 --cdrom /path/to/debian.iso --os-variant debian10

Replace vmname with the name you want to give the virtual machine and /path/to/debian.iso with the path to the Debian Latest ISO image.

The installation process will start and you can follow the instructions on the screen to complete the installation.

Conclusion

In this tutorial, you learned how to install KVM on Debian Latest and create a virtual machine. You can now start experimenting with KVM and its features.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!