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
Download the preferred Ubuntu Core image for your device platform. See Supported platforms for links to images.
By default, images are compressed with xz and can be expanded from the Linux command line with the following command:
$ xz -d <image-name.img.xz>
Booting an Ubuntu Core image with QEMU
The exact QEMU 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=uc.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 uc.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 -i <path-to-private-key> <sso-username>@<device-ip-address> -p 8022
For a brief introduction on how to get started with Ubuntu Core, see Using Ubuntu Core.
Last updated 19 days ago. Help improve this document in the forum.