If you read the official Ubuntu Core docs, you’ll see that the recommended way to run Ubuntu Core virtually is with KVM. However, it’s probably even easier to use it in VirtualBox, and I’ve been getting some questions about that, so I wanted to devote a quick post to it.
- A Linux machine (using Ubuntu 16.04 here). This guide will work on Windows as well, but the command invocations are a bit different and I don’t have a machine on which I can verify them before suggesting them.
- VirtualBox installed and running successfully.
First of all, download the appropriate Ubuntu Core 16 image from here. I’m running 64-bit, so that’s the one I selected. Download it, and uncompress it:
$ wget http://cdimage.ubuntu.com/ubuntu-core/16/stable/current/ubuntu-core-16-amd64.img.xz
$ unxz ubuntu-core-16-amd64.img.xz
You now have a raw disk image. To make it usable within VirtualBox, convert it to a VDI:
$ VBoxManage convertdd ubuntu-core-16-amd64.img ubuntu-core-16-amd64.vdi --format VDI
You now have a VDI that is usable, but is small enough that it’s not very useful. Ubuntu Core will resize itself to fit in whichever disk you give it, so let’s make this disk a bit bigger (remember this is a VDI, so it won’t take any more space), I selected 20GB:
$ VBoxManage modifyhd ubuntu-core-16-amd64.vdi --resize 20480
Finally, create a new machine within VirtualBox. When it comes to the “Hard disk” section, select “Use an existing virtual hard disk file,” and browse to the
ubuntu-core-16-amd64.vdi file you just created. Create the machine. I suggest you change the network interface to be bridged so you can actually SSH to the thing, and then fire it up.
The rest of the directions are the same as KVM. Make sure you have an Ubuntu SSO account with associated SSH keys. As the machine comes up for the first time, eventually it’ll ask you to “Press enter to configure.”
This will immediately jump to a screen asking you to configure your network. If you’re using DHCP, just hit “Done” and move on, where it’ll ask for your email address (it wants the one associated with your Ubuntu SSO account).
From here it’ll look up your account in the store, and allow you to login to the VM via the SSH keys you have in your SSO account.
Enjoy your Ubuntu Core experience!