This process begins by going through a standard ubuntu server 18.04 install.
sudo apt update
sudo apt full-upgrade -y
The universe repository is needed for qemu-guest-agent.
sudo add-apt-repository universe
sudo apt install qemu-guest-agent -y
Once this is done the Qemu agent can be enabled on the host and the VM rebooted.
The serial terminal can be enabled by adding a serial port in the GUI and editing the grub configuration at /etc/default/grub
:
# To GRUB_CMDLINE_LINUX parameter add
GRUB_CMDLINE_LINUX="quiet console=tty0 console=ttyS0,115200"
sudo update-grub
Once this is done and the VM rebooted the console can be accessed with xterm.js
By default ssh is enabled for both ssh keys and passwords, keys can be added with ssh-copy-id
from other clients.
Next a zfs pool needs to be setup for the lxd and docker containers.
sudo apt install zfsutils-linux -y
sudo apt install zfs-zed -y # install for email notifications about zfs errors
sudo zpool create <pool name> mirror <disk1> <disk2> ...
sudo zfs create rpool/lxc
Next LXD can be installed and the LXC network bridged to receive IP addresses from the host network
sudo apt install bridge-utils lxd -y
Edit `/etc/netplan/50-cloud-init.yaml
network:
ethernets:
ens18:
dhcp4: no
version: 2
bridges:
br0:
dhcp4: true
interfaces:
- ens18
Apply the change with:
sudo netplan apply --debug
$ sudo lxd init
Would you like to use LXD clustering? (yes/no) [default=no]:
Do you want to configure a new storage pool? (yes/no) [default=yes]:
Name of the new storage pool [default=default]:
Name of the storage backend to use (btrfs, dir, lvm, zfs) [default=zfs]: zfs
Create a new ZFS pool? (yes/no) [default=yes]: no
Name of the existing ZFS pool or dataset: xpool/lxc
Would you like to connect to a MAAS server? (yes/no) [default=no]:
Would you like to create a new local network bridge? (yes/no) [default=yes]: no
Would you like to configure LXD to use an existing bridge or host interface? (yes/no) [default=no]: yes
Name of the existing bridge or host interface: br0
Would you like LXD to be available over the network? (yes/no) [default=no]:
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]:
$
lxc launch ubuntu: test
lxc exec test ip a
lxc stop test
lxc delete test