Installing LXD as a Snap with Ubuntu Core 16.04 on a Raspberry Pi 3

I have for a long time experimented with LXC/LXD and I’ve got a server running 24/7 in my household to do (among others) DHCP and NS, not because I need but just because I can.

This is of course costing me way too much electricity so I’m exploring the idea to run these services as Linux Containers on a Raspberry Pi 3.

Set-up/prerequisites

  • 1 Raspberry Pi 3
  • A good quality MicroSD card (8GB is used for this proof-of-concept)
  • Ubuntu Core 16.04
  • An account with https://login.ubuntu.com/

 

How I did it

Download Ubuntu Core 16.04

Head over to https://developer.ubuntu.com/core/get-started/raspberry-pi-2-3 and download the Ubuntu Core 16 image for Raspberry Pi 3 (stable) image.

Copy the image to your MicroSD card

Copy the Ubuntu Core image on the SD card by following the installation media instructions.

Boot the Raspbery Pi 3

You’ll be presented with the question to press enter to configure the device and then the networking.

Configured your public key

Make sure you have configured your public key on https://login.ubuntu.com/ so that it’ll be configured on your Ubuntu Core system.

Connect Ubuntu Core to your e-mail address

Ubuntu Core will ask you to enter an e-mail address, enter the e-mail address you use for your account with https://login.ubuntu.com/

Log in on Ubuntu Core

After all is well you’ll be presented with instructions on how to log in to your Ubuntu Core environment.

Install LXD Snap

LXD is available as a Snap since October 2016 (https://stgraber.org/2016/10/17/lxd-snap-available/) so let’s use that.

Create the LXD group

Install LXD

Run LXD in debug mode

You’ll get some output and you’ll have to wait for a couple of minutes for it to go through, remember it’s Pi.

Initialize LXD

Answer questions

Configure MacVLAN

In my setup I like my containers to get fed IP addresses from my DHCP server.

Test it

For some reason it wants to be called like lxd.lxc

This will take quite some time, remember, it’s a Pi.

My newly created container now has a nice fresh IP address from my DHCP server.

Leave a Reply

Your email address will not be published. Required fields are marked *