Installing Ubuntu Core 20

Installing Ubuntu Core 20

Ubuntu Core runs on a large range of hardware, and pre-built images are available for amd64 and Raspberry Pi reference platforms.

Installation on a reference platform is easy and a great way to quickly get started with Ubuntu Core, or to explore Ubuntu Core’s features and evaluate its potential.

Below, we cover installing a reference image of the latest version of Ubuntu Core, UC20:

Ubuntu Core 20 on other platforms:
Installation is very similar across each supported Ubuntu Core 20 device. See Supported platforms for a list of which images are available for which platforms.

Requirements

Alongside enough storage to hold the Ubuntu Core image, installation on a Raspberry Pi also requires a screen and keyboard to navigate a few installation prompts. These aren’t needed post-installation.

Additionally, you will need an Ubuntu SSO account, with associated SSH keys. This setup is required because, after Ubuntu Core has been installed, Ubuntu SSO is used to login to your device. For help importing SSH keys, see the Ubuntu community wiki.

When Ubuntu Core is up and running, if you want to access your device remotely, you’ll need an SSH client for your operating system. Linux and macOS both have clients built-in, whereas Windows users could use Ubuntu on WSL.

Installation steps

The typical installation procedure for UC20 as follows:

  1. Download the preferred Ubuntu Core image for your device
    See Supported platforms for links to device support and images.
    By default, images are compressed with xz and can be expanded with:
    xz -d <image-name.img.xz.
  2. Write the image to your device’s storage medium (eg. SD card for Raspberry Pi)
    We recommend using Raspberry Pi imager for Windows, macOS and Linux.
  3. Boot the device from the flashed storage and follow the on-screen prompts
    This step is version-specific, but the installation typically asks only two questions.

After installation, see Using Ubuntu Core for a quick overview of how to work within the Ubuntu Core environment.

Testing Ubuntu Core with QEMU

You can test Ubuntu Core without specific hardware from within a virtual machine.

To test Ubuntu Core with QEMU (https://www.qemu.org/), on Ubuntu, first install the qemu-kvm package and test it with kvm-ok:

$ sudo apt install qemu-kvm
$ kvm-ok

To ensure compatibility with the required UEFI features in Ubuntu Core 20, also install the OVMF package:

$ sudo apt install ovmf

The exact command to run will depend on your host hardware capabilities, such as available memory and CPU cores, but the following should work in the majority of cases:

$ qemu-system-x86_64 -enable-kvm -smp 2 -m 1500 \
-netdev user,id=mynet0,hostfwd=tcp::8022-:22,hostfwd=tcp::8090-:80 \
-device virtio-net-pci,netdev=mynet0 -drive file=pc.img,format=raw \
-drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on

In the above command, the Ubuntu Core image is called pc.img and we forward the virtual SSH port 22 to port 8022 on the host, and 80 to 8090 for any web server application you wish to install in the VM. To access this configuration from your host machine, type the following:

$ ssh <your key> <SSO identity>@<device IP address> -p 8022

Thank you for this post. I did notice a few problems with the instructions. The qemu command is provided, but there appears to be a duplicate line with part of the word “user” missing on line 2. Also the ubuntu core image is said to be named uc.img, but the command attempts to use an image of pc.img.

Also the text below the SSH command is copied form the previous instruction and does not make much sense.

Some of the corrections may help others in the future.

Hello - thanks so much for taking the trouble to let us know about those errors. I’ve fixed them, and sorry they made their way into the tutorial unchecked. They looked like the pasted detritus from a broken editing session.