Quick instructions to Juju 2.0, LXD, and ZFS on Xenial (16.04)

  sudo apt install zfsutils-linux
  sudo add-apt-repository ppa:juju/devel
  sudo apt-get update
  sudo apt install juju2

Those give you all the latest bits you'll need.

  sudo mkdir /var/lib/zfs
  sudo truncate -s 50G /var/lib/zfs/lxd.img

This makes a sparse 50G file as a storage back-end for LXD containers. Being a sparse file it doesn't actually take up 50G but will fill up as you use the ZFS filesystem for various containers over time. You could alternatively use a spare disk, preferably a nice fast one :)

  sudo zpool create lxd /var/lib/zfs/lxd.img
  sudo zpool status

At this point you should see that you have a ZFS pool setup with nothing going on.

  sudo lxd init --auto --storage-backend zfs --storage-pool lxd
  newgrp -  # I think this is needed to get into the LXD group

You may need to logout and login to be in the lxd group.

And finally:

  juju bootstrap --config default-series=xenial lxd-test lxd

So now:

~$ juju list-controllers 
CONTROLLER       MODEL    USER         SERVER
local.lxd-test*  default  admin@local  10.0.3.161:17070

~$ juju create-model test
created model "test"

~$ juju switch
local.lxd-test:test

~$ juju deploy wordpress

Original source: Juju mailing list