Linux KVM. KVM is a virtualization technology for Linux that allows you to create and run virtual machines (VMs) on a Linux host.
Before we begin, make sure that you have a Linux machine with KVM installed. You can install KVM on Ubuntu or Debian with the following command:
sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager
Creating a Virtual Machine
virt-installcommand. Here is an example command:
This command creates a VM named
my-vm with 2 vCPUs and 2GB of RAM. The VM has a 10GB disk and uses the Ubuntu 20.04 operating system. The VM is connected to a virtual bridge named
virbr0 and has no graphics output. The console output is redirected to a serial port. Finally, the VM is installed from an Ubuntu 20.04 installation ISO available at the given URL.
You can adjust the parameters of this command to suit your needs. For example, you can change the name of the VM, the amount of RAM and vCPUs, the disk size and location, and the network settings.
Starting and Stopping a Virtual Machine
virsh startcommand followed by the name of the VM:
virsh shutdowncommand followed by the name of the VM:
Listing Virtual Machines
Managing Virtual Machines with Virt-Manager
This command opens the Virt-Manager window, where you can view and manage your VMs.
To create a new VM using Virt-Manager, click the
Create a new virtual machine button in the toolbar. This opens a wizard that guides you through the process of creating a new VM.
In this tutorial, we have covered the basics of creating, starting, and stopping virtual machines using KVM on Linux. We have also covered some of the CLI commands and configuration examples for managing virtual machines. With this knowledge, you can start using KVM to create and manage virtual machines on your Linux host.