How to install MAAS

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

This page explains how to install MAAS from scratch.

Important note: There are some PostgreSQL prerequisites that you need to consider before you install. First, PostgreSQL 12 is deprecated as of MAAS 3.5. If you’re not already running PostgreSQL 14, it’s important to upgrade now. Also, you should review the new PostgreSQL requirements in the installation requirements document before installing MAAS.

Install from Snap

To install MAAS from a snap:

  1. Check the MAAS installation requirements to make sure that your hardware will support MAAS.

  2. Enter the following command:

    sudo snap install --channel=X.X maas
where "X.X" is the MAAS version you want to install (3.5, 3.4, 3.3, etc.).
  1. Enter your account password.

At this point, the snap will download and install the chosen version.

Install from packages

To install MAAS from packages:

  1. Check the MAAS installation requirements to make sure that your hardware will support MAAS.

  2. Add the MAAS PPA to your apt repository paths:

    sudo apt-add-repository ppa:maas/X.X

where “X.X” is the MAAS version you want to install (3.5, 3.4, 3.3, etc).

  1. Update your apt repository lists:
    sudo apt update
  1. Install MAAS with the following command:
    sudo apt-get -y install maas
  1. Choose “Y” if asked about whether to continue with the install.

Potential NTP conflicts

When installing MAAS on Ubuntu, there can be conflicts between the existing NTP client, systemd-timesyncd, and the NTP client/server provided by MAAS, chrony. This can lead to time synchronisation issues, especially if MAAS is configured with different upstream NTP servers than the ones used by systemd-timesyncd. To avoid conflicts, users can manually disable and stop systemd-timesyncd using the following command:

sudo systemctl disable --now systemd-timesyncd

Also note that support for PostgreSQL 12 has been deprecated in MAAS 3.3 and will be discontinued in MAAS 3.5.

POC configuration (Snap only)

There is a proof-of-concept configuration defined for the MAAS Snap version. To initialise the MAAS snap in this POC configuration, simply use the --help flag with maas init and follow the instructions.

Production configuration

To install MAAS in a production configuration:

  1. Install PostgreSQL on any machine where you want to keep the database with the following commands:
    sudo apt update -y
    sudo apt install -y postgresql
  1. Create desired values for the following variables (replace them in the commands below):
    $MAAS_DBUSER = ___________
    $MAAS_DBPASS = ___________
    $MAAS_DBNAME = ___________
    $HOSTNAME = _________

Note that for most situations, you can use localhost for $HOSTNAME.

  1. Create a suitable PostgreSQL user:
  1. Create the MAAS database:
    sudo -i -u postgres createdb -O "$MAAS_DBUSER" "$MAAS_DBNAME"
  1. Edit /etc/postgresql/14/main/pg_hba.conf and add a line for the newly created database:
    host    $MAAS_DBNAME    $MAAS_DBUSER    0/0     md5
  1. Initialise MAAS via the following command:
    sudo maas init region+rack --database-uri "postgres://$MAAS_DBUSER:$MAAS_DBPASS@$HOSTNAME/$MAAS_DBNAME"

Distributed environment (packages only)

You can set up a distributed environment when you install with MAAS packages. To run MAAS region and rack controllers on separate machines:

  1. Check the MAAS installation requirements to make sure that your hardware will support MAAS.

  2. Add the MAAS PPA to your apt repository paths on both region and rack target hosts:

    sudo apt-add-repository ppa:maas/X.X

where “X.X” is the MAAS version you want to install.

  1. Update your apt repository lists on both region and rack hosts:
    sudo apt update
  1. Install the MAAS region controller on the target region host:
    sudo apt install maas-region-controller
  1. Install the MAAS rack controller on the target rack host:
    sudo apt install maas-rack-controller
  1. Register the rack controller with the region controller by running the following command on the rack host:
    sudo maas-rack register

These two steps will lead you through two similar apt install sequences.

Create an admin user

To create a MAAS administrative user:

  1. Create a MAAS administrator user to access the web UI:
    sudo maas createadmin --username=$PROFILE --email=$EMAIL_ADDRESS
Substitute `$PROFILE` with the administrative MAAS username you wish to create. `$EMAIL_ADDRESS` is an email address you may type in at random (currently, MAAS does not use this email address). The `createadmin` option will cause MAAS to ask for an SSH key.
  1. To use an SSH key associated with your launchpad accounts, enter lp:$USERNAME (substitute your LP username for $USERNAME).

  2. Alternatively, to use an SSH key associated with your github account, enter gh:$USERNAME (substitute your github username for $USERNAME)

Check MAAS status

To check the status of running services, enter:

sudo maas status

Typical output looks like this:

bind9                            RUNNING   pid 7999, uptime 0:09:17
dhcpd                            STOPPED   Not started
dhcpd6                           STOPPED   Not started
ntp                              RUNNING   pid 8598, uptime 0:05:42
postgresql                       RUNNING   pid 8001, uptime 0:09:17
proxy                            STOPPED   Not started
rackd                            RUNNING   pid 8000, uptime 0:09:17
regiond:regiond-0                RUNNING   pid 8003, uptime 0:09:17
regiond:regiond-1                RUNNING   pid 8008, uptime 0:09:17
regiond:regiond-2                RUNNING   pid 8005, uptime 0:09:17
regiond:regiond-3                RUNNING   pid 8015, uptime 0:09:17
tgt                              RUNNING   pid 8040, uptime 0:09:15

Your mileage may vary.

More init options

The init command can takes optional arguments. To list them, as well as read a brief description of each, you can enter:

sudo maas init --help

Configure MAAS with the UI

To configure MAAS for first-time use with the MAAS UI:

  1. Access MAAS at this address, where $API_HOST is the hostname or IP address of the region API server, which was set during installation:
  1. Log in at the prompts, with the login information you created when initialising MAAS.

  2. On the first welcome screen, set the DNS forwarder to a suitable value, e.g., This could be your own internal DNS server, if you have one.

  3. Select an Ubuntu image to import; you may be required to select at least one LTS version.

  4. Click Continue; a screen labelled, “SSH keys for admin:” appears.

  5. In the Source drop-down, select “Launchpad,” “Github,” or “Upload.”

  6. If you want to upload your SSH public key from Launchpad, you would enter the following, where <username> is your Launchpad username:

  1. If you want to upload your github public SSH key, you would enter the following, where <username> is your GitHub username:
  1. If you want to use your existing public key from your home directory, select Upload.

  2. Copy your entire public key from .ssh/ (or wherever you may have stored the key).

  3. Paste the public key into the block labelled “Public key.”

  4. Press the “Import” button to import this key.

  5. You should see a message that MAAS has been successfully set up. Click Go to the Dashboard to proceed.

  6. Select Subnets from the top menu.

  7. Choose the VLAN on which you want to enable DHCP.

  8. Select Enable DHCP.

You should now be able to add, commission, and deploy machines.

Configure MAAS with the CLI

Login to the MAAS CLI via the following process:

  1. Generate the API-key for the login you’re going to use, replacing $PROFILE with whatever username you set during the createadmin part of the install process.
    sudo maas apikey --username=$PROFILE > api-key-file
  1. Login with the following command, substituting $MAAS_URL with the URL that was returned to you when you initialised MAAS, for example, :
    maas login $PROFILE $MAAS_URL < (cat api-key-file) 
  1. Set upstream DNS ( is always a reliable value):
    maas $PROFILE maas set-config name=upstream_dns value=""
  1. Add a public SSH key to a MAAS user account:
    maas $PROFILE sshkeys create "key=$SSH_KEY"
  1. See what images you may have already downloaded:
    maas $PROFILE boot-resources read | jq -r '.[] | "\(.name)\t\(.architecture)"'
  1. Select an image(s) for download (e.g., “trusty” in this example):
    maas $PROFILE boot-source-selections create 1 os="ubuntu" release="trusty" arches="amd64" subarches="*"  labels="*"
  1. Import your selected image(s):
    maas admin boot-resources import
  1. Identify a valid fabric ID for DHCP (returns "fabric_id": $FABRIC_ID,):
    maas $PROFILE subnet read $SUBNET_CIDR | grep fabric_id
  1. Find the name of the primary rack controller:
    maas $PROFILE rack-controllers read | grep hostname | cut -d '"' -f 4
  1. Create an IP range for DHCP (in this case, a dynamic range):
    maas $PROFILE ipranges create type=dynamic start_ip=$START_IP end_ip=$END_IP
  1. Use this collected information to turn on DHCP:
    maas $PROFILE vlan update $FABRIC_ID untagged dhcp_on=True primary_rack=$RACK_CONTR_HOSTNAME

You should now be able to add, commission, and deploy machines.

Last updated 4 days ago.