Creating a LXD Server on Hetzner Cloud and Block Storage Volumes (XFS)

Creating the Server

Start by creating a server, I recommend Ubuntu 18.04

For Type I recommend selecting Ceph Network Storage for addtional redundancy.

Create a volume for LXD storage. Select XFS for your filesystem.

Select any addtional features you want, add your SSH key (optional) and name your server.

You should now see your server starting up in your server list

Configuring The Server

Get the IP address (or hostname if you already have DNS setup) and SSH to your server. On Windows 10 has SSH support built into the Powershell and Command Prompt. You can use Putty or MobaXterm if you have a older version of Windows. For Mac or Linux you can just use the terminal.

As soon as you login, you will be forced to change your root password. After changing we have changed the root password let’s allow SSH and enable the firewall

ufw allow ssh
ufw enable

You will getting a warning that command may disrupt existing ssh connection. Type y and press Enter to continute. You should get the following message:

Firewall is active and enabled on system startup

Next, we should update the server to ensure we have all the latest updates.

apt-get update
apt-get upgrade

Once the updates are done, we now can install LXD. Ubuntu 18.04 comes with LXD installed as a DEB package, however the recommended way to install it is via snap. Remove the DEB packages using the following command:

sudo apt remove --purge lxd lxd-client liblxc1 lxcfs

Then install LXD via snap

sudo snap install lxd

Configuring Storage

Install zfsutils-linux

sudo apt-get install zfsutils-linux

Create a zpool and add your drive to it

zpool create -f <pool_name> <drive>

Check the status of the zpool by running:

zpool status

Setup LXD

You can setup LXD by running the following command:

lxd init

Answer the questions based on how you want to use LXD. When get to this questiong, type no.

Create a new ZFS pool? (yes/no) [default=yes]: no

Then you will be asked for the existing pool name, enter your existing pool name you made in the pervous steps.

Name of the existing ZFS pool or dataset: <pool_name>

Continure on answer the questions based on how you want to use LXD.

That’s it! You should now be able to create your first container!

Leave a comment

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