Install Ubuntu Core on KVM
Install Ubuntu Core
We will walk you through the steps of installing Ubuntu Core 20 on your Linux desktop in a virtual machine.
- An Ubuntu SSO account with an SSH key
- A computer running Ubuntu Desktop
Set up an Ubuntu SSO account
An Ubuntu SSO account is required to create the first user on an Ubuntu Core installation.
- Start by creating an Ubuntu SSO account.
- Import an SSH Key into your Ubuntu SSO account. (instructions)
Download Ubuntu Core
- Download the Ubuntu Core 20 image for amd64.
- You can verify the integrity of the files using the SHA256SUM and SHA256SUM.gpg files.
Uncompress the image with the following command:
Install the qemu-kvm package with the following command:
sudo apt install qemu-kvm ovmf
Then, run the kvm-ok command to check KVM status and your hardware:
The message should say:
INFO: /dev/kvm exists KVM acceleration can be used
This is the best outcome — it means that Ubuntu Core will run fast on your system, taking advantage of hardware acceleration in your CPU.
You can now launch a virtual machine with KVM, using the following command:
qemu-system-x86_64 -smp 2 -m 2048 -net nic,model=virtio -net user,hostfwd=tcp::8022-:22,hostfwd=tcp::8090-:80 -vga qxl -drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on -drive file=ubuntu-core-20-amd64.img,cache=none,format=raw,id=disk1,if=none -device virtio-blk-pci,drive=disk1,bootindex=1 -machine accel=kvm
Note: this command sets up port redirections:
localhost:8022is redirecting to port
22of the virtual machine for accessing it through SSH
localhost:8090is redirecting to its port
Note: this command is required for graphics such as mir-kiosk:
-vga qxlsets the paravirtual graphics driver qxl
You should now see a window, with your Ubuntu Core virtual machine booting inside it.
First boot setup
- The system will boot then become ready to configure.
- The device will display the prompt "Press enter to configure".
- Press enter then select "Start" to begin configuring your network and an administrator account. Follow the instructions on the screen, you will be asked to configure your network and enter your Ubuntu SSO credentials.
At the end of the process, you will see your credentials to access your Ubuntu Core machine:
This device is registered to <Ubuntu SSO email address>. Remote access was enabled via authentication with the SSO user <Ubuntu SSO user name> Public SSH keys were added to the device for remote access.
Once setup is done, you can login with SSH into Ubuntu Core, using the following command:
ssh -p 8022 <Ubuntu SSO user name>@localhost
Your username is your Ubuntu SSO user name, shown to you at the end of the account configuration step.
First boot tips
- During setup,
console-confwill download the SSH key registered with your Store account and configure it so you can log into the device via
ssh <Ubuntu SSO account name>@<device IP address>without a password.
- There is no default
ubuntuuser on these images, but you can run
sudo passwd <account name>to set a password if you need a local console login.
Get started with snaps
Your virtual machine is now ready to have snaps installed, it's time to use the snap command to install your first snap.
The Snap Store is where you can find the best Linux apps packaged as snaps to install on your Ubuntu device and get started with your secure IoT journey.
Before you start, get your IoT security story straight
A recent Canonical survey of 2,000 consumers suggests that a shockingly high percentage of connected devices may be vulnerable to botnets, hackers and cyber attacks:
- Only 31% of consumers update the firmware on their connected devices as soon as updates become available.
- 40% of consumers have never performed firmware updates on their connected devices
- 40% of consumers believe that performing firmware updates on their connected devices is the responsibility of either software developers or the device manufacturer