This brief tutorial shows students and new users how to install KVM on Ubuntu 20.04 | 18.04.
KVM (Kernel-based Virtual Machine) is an open source full virtualization solution for Linux systems, including Ubuntu… Like VirtualBox, VMware Workstation, KVM is a virtualization infrastructure for the Linux kernel that turns it into a hypervisor….
This brief tutorial shows students and new users how to install KVM kernel modules on Ubuntu server to enable full virtualization….
If you can’t install VirtualBox or VMware Workstation virtualization solutions on Ubuntu, then you can try KVM…. After installing, use KVM module to install and run multiple virtual machines (guest) on Linux servers…
These virtual machine can be managed via virt-manager graphical user interface or virt-install & virsh cli commands….When you’re ready to install KVM, follow the steps below:
Step 1: Check your System
Not all systems can install and run KVM modules….. If your’re running a server that isn’t compatible, KVM can’t be used on it… to check, run the commands below to install a CPU checker tool:
sudo apt install cpu-checker sudo kvm-ok
After installing, the above commands check the CPU compatibility with KVM… If KVM is compatible you should get message that KVM acceleration can be used…
KVM acceleration can be used
if KVM isn’t compatible for your system, you’ll get a message that reads
INFO: Your CPU does not support KVM extensions KVM acceleration can NOT be used
The message above shows you can’t run KVM…
Step 2: Install KVM Packages
If steps 1 is good, then run the commands below to install KVM packages to enable full virtualization functionality on Ubuntu via Linux kernel….
sudo update sudo apt install qemu qemu-kvm libvirt-bin bridge-utils virt-manager
After installing KVM packages, run the commands below to start and enable it to automatically startup when the system boots..
sudo systemctl start libvirtd sudo systemctl enable libvirtd
Step 3: Configure Network Bridge for the Virtual Machine
KVM virtualization module requires network bridge for its virtual guest machines… On Ubuntu 18.04 server, a new file /etc/netplan/50-cloud-init.yaml file is created for network configurations… Use this file to configure static IP and bridge and netplan utility will refer this file….
To create a new network bridge, run the commands below to open Ubuntu network config file….
sudo nano /etc/netplan/50-cloud-init.yaml
Then add a new bridge section [highlighted] to the file and save..
network: ethernets: enp0s3: dhcp4: no dhcp6: no version 2 bridges: br0: interfaces: [enp0s3] dhcp4: no dhcp6: no addresses: [22.214.171.124/24] gateway4: 126.96.36.199 nameservers: addresses: [188.8.131.52]
Save the file and exit
Next, run the commands below to apply the changes..
sudo netplan apply sudo netplan --debug apply
Next, continue below to start creating your VMs…
Step 4: Create New VMs
Now that the server is configured, open KVM virtual machine manager and start creating new virtual guest machine… First connect to the server, then create a new machine by clicking New Virtual Machine
Then choose how to install the guest machine… you can use a local ISO media or via network / PXE install
Next, browse for the ISO file if you’re going to be installing via ISO and select the file with the OS… This this post we’re going to be installing Ubuntu server…
After selecting the OS file, continue to create a setup a local disk, system memory and other settings…
When you’re done, boot the VM to install Ubuntu
This post showed you how to install KVM on Ubuntu 20.04 | 18.04. If you find any error above, please use the comment form below to report.
You may also like the post below: