Tutorial: Bootstrapping MAAS

Errors or typos? Topics missing? Hard to read? Let us know.

MAAS simplifies hardware management in data centres and clouds, offering scalable deployment. This tutorial will take you through a typical MAAS usage scenario.

Prerequisites

  • Hardware meeting minimum requirements.
  • Knowledge of Ubuntu and basic Linux commands.
  • Understanding of networking concepts.
  • An Ubuntu server with internet access.
  • Administrative rights for setup.

Dependencies

PostgreSQL

  1. Install and configure PostgreSQL for MAAS:

    sudo apt install postgresql postgresql-contrib
    sudo su - postgres
    psql
    CREATE USER maas WITH PASSWORD 'password';
    CREATE DATABASE maasdb OWNER maas;
    \q
    exit
    
  2. Edit /etc/postgresql/<version>/main/pg_hba.conf, adding a line like the following, to allow the MAAS user to connect:

    sudo vi /etc/postgresql/<version>/main/pg_hba.conf
    host    maasdb    maas    0/0     md5
    

Snap dependency

sudo apt update
sudo apt install snapd

LXD

  1. Install snap package

    sudo snap install lxd
    
  2. Initialise the LXD

    sudo lxd init
    

    Default values are fine, but ensure to make the LXD server available over the network.
    If you skiped it, you can do it later with lxc config set core.https_address :8443
    Notice the new local network bridge, created by default, with lxdbr0 name.

  3. Disable LXD’s built-in DHCP server:

    lxc network set lxdbr0 ipv4.dhcp=false 
    

MAAS Installation

  1. Install snap package:

    sudo snap install maas
    
  2. Initialise using PostgreSQL provisioning database and credentials

    sudo maas init region+rack --database-uri postgres://maas:password@localhost/maasdb
    
  3. Make a note of the URL this command returns (similar to the following); you’ll need it later:

    http://<ip-address>:5240/MAAS
    
  4. Create admin credentials to access MAAS console through previous URL.
    Email is not validated, so any value is acceptable.
    Optionally, you can enter your SSH Keys here, or later on.

    sudo maas createadmin
    

MAAS is now installed.

Initialisation

When you access MAAS console for the first time, you might get some warnings and errors; we will take care of them during the Initialisation.

This initialisation step can be skipped, and configured, later on, from [ Settings ].
The tutorial required steps will be noted, bug feel free to modify any of the wizard offered values.

  1. Access MAAS with the URL and credentials from previous step.

  2. [ Connectivity > DNS forwarder ], set a server, such as 8.8.8.8.
    Save and Continue

  3. Under [ Images ], select the Ubuntu releases to sync; you can usually accept the default. Wait for its status to be synced.
    Continue and Finish Setup

  4. Under [ SSH keys for admin ], import your SSH public key from Launchpad or GitHub, or upload your existing public key. Follow the on-screen instructions.
    This will enable SSH access to the created VM instance as last steps of the tutorial.
    Finish Setup

MAAS can now manage and provision nodes.

Network and DHCP configuration

  1. Identify the LXD bridge IP address:

    ip addr show lxdbr0
    
  2. In MAAS, go to [ Networking > Subnets ] and identify the VLAN for that subnet.

  3. Select the VLAN, by clicking its value under the VLAN column. It may have the untagged value.

  4. On Configure DHCP, confirm MAAS provides DHCP is checked, with the default Rack controller value selected. Provide a Reserved dynamic range and confirm Configure DHCP

MAAS now provides networking and DHCP for provisioning LXD virtual machines.
At this stage no warnings no errors should be shown on the MAAS console interface.

Create a VM host

Create a LXD VM host with a MAAS-generated certificate so they can talk to each other:

  1. Select [ KVM > LXD > Add LXD host ].

  2. Enter a Name for the KVM host.

  3. Optionally, select a non-default Zone, or a non-default Resource pool.

  4. Enter the LXD address as the gateway address of the bridge for that LXD instance.
    From previous extracted lxdbr0 network, pick the first IP value.
    As for the port, we will use the one initialised on LXD setup, by default 8443.
    You can validate these values provide connectivity by doing a telnet, or confirming it opens the LXD UI
    Input the <lxdbr0_server_ip>:<lxdbr0_port> value

  5. Verify Generate new certificate is selected and Next.

  6. Verify Add trust to LXD via command line is selected, and run the shell command. Optionally you can download the certificate.

  7. If command run without errors, proceed with Check authentication. If MAAS can connect with LXD you will get a Connected with a green check-mark.

  8. Select Add new project or Select existing project. Be aware that if you select an existing project, any virtual machines already in that project will begin to commission.

  9. Select Save LXD host. You will drop out to a dashboard for the VM host.

MAAS now has a VM host which can support LXD virtual machines.

Add a LXD VM

Add a virtual machine from the MAAS UI:

  1. Select [ KVM > LXD > previously created VM host > Add VM ].

  2. You can use the defaults and just press Compose machine.
    Alternatively, go through the optionals.

  3. Optionally, enter the VM name.

  4. Optionally, select Use any available core(s) or Pin VM to specific core(s), as needed. Enter specific core identities as appropriate.

  5. Optionally, enter the RAM required.

  6. Optionally, select Show advanced if you want to edit the Domain, Zone, Resource pool, or Architecture. Make those changes as needed.

  7. Optionally, define Interfaces.

  8. Optionally, configure Storage configuration, or Add disks.

  9. Select Compose machine to create the virtual machine.

The VM will start commissioning through various steps and tests.
You can click on the list, VM Name column value, it to inspect the details and logs.

Acquire the VM

If the host was correctly commissioned, it will have the ‘Ready’ status.

To acquire (or allocate) your new machine so that only you can deploy it, select the VM and [ Action/Take action > Allocate > Allocate machine ].
Status will change to Allocated, which means that MAAS is now ready to deploy your newly-created virtual machine.

Deploy the VM

Select your allocated VM [ Action/Take action > Deploy ].
Default values are enough to Deploy machine.

The VM’s status will change several times as MAAS steps through the process (Deploying, …) .
When done, the status becomes the name of the deployed operating system (e.g. ‘Ubuntu 18.04 LTS’).

After deployment

SSH into deployed machine with username ubuntu.

ssh ubuntu@<vm_ip>

You will not be asked for a password, but the provided SSH key, from MAAS First Setup will be used. Feel free to explore the deployed VM.

Cleanup

sudo snap remove --purge lxd maas

Optionally, you can delete MASS stored data

sudo su - postgres
psql
DROP DATABASE maasdb;

Further learning

Dive deeper into MAAS features and in the explanation, how-to guides, and reference sections.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.

The process for generating an encrypted password doesn’t match the example “CREATE USER” command provided. That command presumes an MD5 password hash, but the example encrypted password command provided uses SHA512 instead. Someone who doesn’t notice this may end up stuck here.

It also seems like the procedure is very similar to that in the howto section, although the howto section uses bash variables to set things up and doesn’t rely on md5 hashing. Reference: https://maas.io/docs/how-to-do-a-fresh-install-of-maas#heading--init-maas-production-3-3

Should these two similar sections be brought into alignment?

Hi, I noticed that this tutorial says to install LXD using the debian package.

sudo apt install [...] lxd lxd-client [...]

From the debian package page for LXD:

It is very unlikely that newer versions of LXD will be available in Debian.

The correct way to install LXD should thus be using the snap package.

sudo snap install lxd