We will walk you through the steps of installing Ubuntu Core on your Linux desktop in a virtual machine.
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 on this page. Instructions to generate an SSH Key on your computer can be found here
Install the qemu-kvm package with the following command:
sudo apt install qemu-kvm
Then, run the kvm-ok command to check KVM status and your hardware:
kvm-ok 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.
Download the Ubuntu Core image for amd64 and uncompress it with the following commands:
wget http://cdimage.ubuntu.com/ubuntu-core/16/stable/current/ubuntu-core-16-amd64.img.xz unxz ubuntu-core-16-amd64.img.xz
You have an image ready to boot.
You can now launch a virtual machine with KVM, using the following command:
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=ubuntu-core-16-amd64.img,format=raw
Note that this command also sets up port redirections:
localhost:8022is redirecting to port
22of the virtual machine for accessing it through SSH
localhost:8090is redirecting to its port
You should see a window, with your Ubuntu Core virtual machine booting inside it.
- 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
The user name is your Ubuntu SSO user name, it has been reminded to you at the end of the account configuration step.
- 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 -p 8022 <Ubuntu SSO account name>@localhostwithout a password.
- There is no default
ubuntuuser on these images, but you can run
sudo passwd <account name>to set a password in case you need a local console login.
Your virtual machine is ready to have snaps installed.