Installing Ubuntu Desktop 20.04 on KVM

Install Ubuntu desktop on KVM

In this tutorial, we will review how to install Ubuntu desktop on KVM. For this particular demonstration, we will examine version 20.04 of the operating system or Focal Fossa as it’s commonly known by codename.

Table of Contents

Introduction

Installing an Ubuntu Desktop instance on KVM is a straightforward process that we will review in this tutorial. Ubuntu is a Debian-based Linux distribution that’s for the most part,  free and open source. It is developed by the UK-based privately held company Canonical and released every six months, with long-term support (LTS) releases every two years.

Install Ubuntu Desktop on KVM - logo

Image adapted from Josh Sorenson at Pexels

The Ubuntu OS runs on everything from desktops, servers, smartphones, and laptops, to virtual machines, internet of things (IoT) devices and robots. However, for the purposes of this tutorial, we will focus on the latest LTS release as of the date of this publication: Ubuntu 20.04 (“Focal Fossa”).

Pre-Installation Checks

This tutorial assumes you have a Linux machine available with KVM already installed. If this is true, proceed to the next step and download the Ubuntu Desktop 20.04 ISO from the Ubuntu website. 

Download latest Ubuntu ISO

You can also download the iso using the wget command (below): The Ubuntu-20.04.4 release is the latest available .iso as of the date of this publication.

				
					[admin@kvm-host02 ~]$ wget https://www.releases.ubuntu.com/20.04/ubuntu-20.04.4-desktop-amd64.iso
				
			

If you received the following error message (below), it is due to a certificate issue on the website.

				
					[admin@kvm-host02 ~]$ wget https://www.releases.ubuntu.com/20.04/ubuntu-20.04.4-desktop-amd64.iso
--2022-04-17 03:26:26-- https://www.releases.ubuntu.com/20.04/ubuntu-20.04.4-desktop-amd64.iso
Resolving www.releases.ubuntu.com (www.releases.ubuntu.com)... 91.189.91.123, 185.125.190.37, 91.189.91.124, ...
Connecting to www.releases.ubuntu.com (www.releases.ubuntu.com)|91.189.91.123|:443... connected.
ERROR: no certificate subject alternative name matches
requested host name ‘www.releases.ubuntu.com’.
To connect to www.releases.ubuntu.com insecurely, use `--no-check-certificate'.
				
			

Therefore, you may issue the same command with the --no-check-certificate option. We’re just downloading the .iso file from the website, so this a harmless procedure.

				
					[admin@kvm-host02 ~]$ wget https://www.releases.ubuntu.com/20.04/ubuntu-20.04.4-desktop-amd64.iso --no-check-certificate
				
			

Create qcow2 disk image

Next, we’ll cd into the images directory (default image store for KVM). Using the qemu-img utility, we’ll create a qcow2 disk image that will serve as storage for our Ubuntu Desktop virtual machine (below). Also, we’ll allocate 75GB to our new disk image named dev-infotechys-7.img. 

				
					[admin@kvm-host02 /var/lib/libvirt/images]$ sudo qemu-img create -f qcow2 dev-infotechys-7.img 75G
Formatting 'dev-infotechys-7.img', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=80530636800 lazy_refcounts=off refcount_bits=16
				
			

Installing Ubuntu Desktop 20.04 (Step-by-Step)

Now that the ISO is downloaded and disk image is in place, we can begin the installation using KVM (virt-manager).

Launching the virt-manager

First, launch the virt-manager on your KVM host as the root user.

				
					[root@kvm-host02 ~]$ virt-manager
				
			

Create a new virtual machine

Next, click the computer monitor icon (circled in red below) to continue.

Install Ubuntu Desktop on KVM - Launch virt-manager

Choose an ISO

Then, you will be prompted to choose the ISO you would like to use for the install. Click the [Browse] button and select the path to your ISO file. Or, enter it in the text box. For this tutorial, the Ubuntu Desktop 20.04.4 ISO is located under /isos. Click the [Forward] button to continue.

Selecting iso and volumes
Selecting iso and volumes

Memory and CPU settings

In step 3 of 5, you will be prompted to choose the memory and CPU settings for your Ubuntu Desktop instance. For this demonstration, we entered 4096 MB or 4GB for the RAM and 2 CPUs or cores. Click the [Forward] button to continue.

CPU and RAM settings - Ubuntu on KVM

Choose disk image

In step 4 of 5, you will be prompted to decide how you want to set up a disk image for your Ubuntu Desktop 20.04 virtual machine. You’ll notice that the “Create a disk image” option is selected by default. We are not going to select this option because we created a qcow2 disk image (dev-infotechys-7.img) earlier–that we’d like to use. 

Instead, choose the “Select or create custom option” below it and click the [Manage] button to continue. You will be presented with another window listing the contents of /var/lib/libvirt/images. Select your qcow2 image and click the [Choose Volume] button to continue (all highlighted in red).

Install Ubuntu Desktop on KVM - Choose a disk image

Finalize and Review Settings

In step 5 of 5, we are about ready to begin the installation. There are just a few remaining housekeeping details we need to attend to.

First, enter a name for your Ubuntu Desktop instance. We’re going with vm7-dev-infotechys.com for this demonstration. Choose a name that suits you. Next, click the checkbox to select the “Customize configuration before Install” option. It will allow us to ensure everything checks out before we proceed with install.

Finally, select the “Bridge device” option from the dropdown menu and enter in your bridge interface. For our KVM host, the bridge interface is br03. Your interface will likely be different. Click the [Finish] button to continue.

Naming the VM and configure bridge setting

As you can see (below), everything looks good. We’ve even added a brief note in the description textbox, stating the type of VM we are building. We are now ready to proceed with the Ubuntu Desktop Installer portion. Click the [Apply] and [Begin Installation – Green Check mark] button to continue (circled in red).

Finalizing the VM creation process

The Ubuntu Desktop Installer

At the initial Ubuntu installer screen, you’ll notice that an automatic check of the disk image will begin. Press the [Ctrl+C] keys to skip this process and proceed with the installation process. 

Install Ubuntu Desktop on KVM - Installer Screen

Installer: Welcome screen

Now, you will arrive at the Ubuntu Desktop welcome screen.  Select the language that suits you and click the [Install Ubuntu] button to proceed (highlighted in green).

Ubuntu Installer - Choose language

Detecting Keyboard Layout

Depending on the region of the world you belong to, click the [Detect Keyboard Layout] button to allow the installer to detect your keyboard configuration. However, if you’re from the US or an English-speaking country, you may skip the keyboard layout detection process and click the [Continue] button to proceed with the installation.

Install Ubuntu Desktop on KVM - Keyboard Layout Detection

Selecting installation (packages)

Next, you will be presented with a choice to proceed with a normal installation which includes a web-browser (Firefox), utilities, office software, media players, games, etc. Or, the minimal installation which includes a web-browser and basic utilities. For this tutorial, we will click the [Continue] button to proceed with the default normal installation option.

Selecting an installation - normal

Selecting an installation (type)

For the installation type, we will select the [Something else] option, because we want to create and resize partitions to our specifications. Click the [Continue] button to proceed.

Install Ubuntu Desktop on KVM - Installation Type

Setting up Filesystem Partitions

We will setup our filesystem partitions according to the following specifications:

  1. Using the Logical Volume Manager (LVM)
  2. Using the XFS filesystem (by default the EXT4 filesystem is selected)

Partition specifications

The manual disk partitioning procedure will include the following changes:

  1. Allocate 20GB of storage space to the /root partition (20531 MB)
  2. 10GB to the /home partition (10500 MB)
  3. 2GB to the /boot partition (2048 MB)
  4. 4GB to the swap partition (4096 MB)
  5. Allocate the remaining available space (roughly 43GB) to the /extras partition. We can use this partition for extending or creating logical volumes as we see fit in the future.

Creating the root partition

We will begin by creating the root (/) partition. First, click the [New Partition Table] button and will be presented with a pop-up window, warning you that all existing partitions will be deleted. Click the [Continue] button to proceed (highlighted in green).

Creating the root partition
Create the root partition - Continued

As you can see, all of the available space on the disk has been allocated to free space (80+ GB in this example). Now, click the plus (+) sign to create a new partition (highlighted in green below).

Create the root partition - Continued 2
Create the root partition - Continued 3

In the size text field, enter the 20531 MB which roughly represents 20GB of storage space allocated. For the type of partition, select the Logical option and XFS journaling file system. Finally, select the (/) in the drop down which is the universal symbol for the root partition. Click the [OK] button to continue.

Create the root partition - Continued 4

As you can see, there is roughly 60GB of free space available to create the remaining partitions listed in the “partitions specifications” section. Highlight the free space option and click the (+) button to create the /home, /boot, swap, and /extras partitions. Repeat the steps listed in this “creating the root partition” section to setup the remaining partitions and finally, click the [Install Now] button to continue with the installation.

Create the root partition - Continued 5
Create the root partition - Continued 6

When you’re finished setting up the filesystem partitions, you screen should look similar to the images below. Click the [Install Now] button to continue and save your changes to the disk.

Create the root partition - Continued 7
Create the root partition - Continued 8

Selecting a timezone

You will be presented a screen with an option to select a timezone according to the region you belong to. We are selecting the “New York” timezone, because we are located in the Eastern region of the United States (US). Click the [Continue] button to proceed.

Install Ubuntu Desktop on KVM - Timezone settings

User account and hostname settings

Now, you will be prompted (in the who are you? window) to create a user account with administrative rights as well as, provide a password and the system name or hostname for your Ubuntu Desktop virtual machine. We’ve selected admin-it as the user and vm7 for the system name (below). Click the [Continue] button to proceed.

Install Ubuntu Desktop on KVM - Administrative Account

Ubuntu Desktop 20.04 package installation

Congratulations! You can now walk away from your keyboard as the installer will begin installing the necessary Ubuntu Desktop packages automatically. This process will take a some time to complete–depending on the speed of your CPU.

Package Installation - part 1
Package Installation - Part 2

When the package installation is complete, you will be prompted to restart your virtual machine. Click the [Restart Now] button to proceed.

Rebooting your VM

Your machine should boot to a login screen and thus, bring us to the end of this tutorial.

Install Ubuntu Desktop on KVM - Login Screen

Post-Installation Steps

Upon logging onto your Ubuntu Desktop instance for the first time, you may be prompted to install the latest software updates or configure livepatch, privacy, and other settings. I’ll leave those decisions up to you. However, for this tutorial, we decided to skip through those options to arrive at the desktop screen (below).

Install Ubuntu Desktop on KVM - Desktop Screen

Conclusion

Congratulations! You’ve just completed a successful install of Ubuntu 20.04 Desktop virtual machine on KVM. As part of this process we reviewed some system configuration and administration topics like user account and hostname configuration, logical volume manager (LVM), and custom disk partitioning.

Was this article helpful to you? If so, leave us some feedback in the comments section. We’d love to hear from you.

Related Posts

Install CentOS8 on KVM
Commands
Install CentOS8 on KVM

In today’s tutorial, we will install CentOS8 on KVM. The install process is fairly straightforward and we will cover it here step-by-step. We will follow

Read More »

Leave a Reply

Your email address will not be published. Required fields are marked *