Bootstrap MAAS

This tutorial provides an in-depth walkthrough of installing, configuring, and preparing MAAS to manage your physical server infrastructure.

Installing MAAS

To install MAAS on your Ubuntu host:

  1. Update your package index and install dependencies:

    sudo apt update
    sudo apt install snapd lxd lxd-client python3-lxc python3-openstackclient
  2. Install the MAAS snap package:

    sudo snap install maas --classic
  3. Install the PostgreSQL database:

    sudo apt install postgresql postgresql-contrib
  4. Switch to the postgres user and open the PostgreSQL shell:

    sudo su - postgres
  5. Create a database user for MAAS:

    CREATE USER maas WITH PASSWORD 'password';
  6. Create the MAAS database:

    CREATE DATABASE maasdb OWNER maas;
  7. Exit PostgreSQL and return to your regular user:

  8. Edit /etc/postgresql/12/main/pg_hba.conf, adding a line like the one below, to allow the MAAS user to connect:

    sudo vi /etc/postgresql/12/main/pg_hba.conf
    host    $MAAS_DBNAME    $MAAS_DBUSER    0/0     md5
  9. Initialize MAAS, specifying the PostgreSQL URL:

    sudo maas init region+rack --database-uri postgres://maas:password@localhost/maasdb
  10. Visit the web UI and create your admin account.

MAAS is now installed!

Configuring MAAS

After installing, complete further configuration:

  1. Access MAAS at this address, where $API_HOST is the MAAS URL which was generated earlier:


    Log in using the login information you created when initializing MAAS.

  2. In the web UI, go to Settings > General and set a forward DNS server, such as “”.

  3. Under Images, select the Ubuntu release to sync; you can usually accept the default.

  4. Under Accounts, import your SSH public key from Launchpad or GitHub, or upload your existing public key. Follow the on-screen instructions.

  5. Review remaining config options like proxy usage, NTP, etc.

MAAS can now manage and provision nodes.

Setting up LXD

To manage LXD containers alongside physical servers:

  1. Install the LXD snap:

    sudo snap install lxd
  2. Initialize the LXD configuration:

    sudo lxd init

    Choose appropriate options for networking, storage pools, etc.

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

    lxc network set lxdbr0 ipv4.dhcp=false 

Configuring Networking and DHCP

Finally, configure networking and DHCP:

  1. Identify the LXD bridge IP address:

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

  3. Select the VLAN and configure DHCP with the bridge IP as the gateway.

MAAS now provides networking and DHCP for provisioning.

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:

Should these two similar sections be brought into alignment?