MAAS 3.1 has been released. Find out what’s new in 3.1.

Build a MAAS and LXD environment in 30 minutes with Multipass on Ubuntu

1. Overview

Installing MAAS itself is easy, but building an environment to play with it is more involved. MAAS works by detecting servers that attempt to boot via a network (called PXE booting). This means that MAAS needs to be on the same network as the servers.

Having MAAS on the same network as the servers can be problematic at home or the office, because MAAS also provides a DHCP server and it can (will) create issues if target servers and MAAS try to interact on your usual network.

We wanted to make it easier to go hands on with MAAS, so we created this tutorial to enable people to do that, right on their own PC or laptop.

A potential MAAS test setup

One way to try MAAS is to have a separate network, such as a simple switch+router, with several servers attached. One of these servers runs MAAS, and the others are target servers that MAAS can provision. Such a setup might look like this:


If all you want to do is take a look at MAAS and play with it casually, then this type of setup is a bit too involved. That’s why we decided to use Multipass to create a virtual environment - which you can learn more about below.


Multipass is a tool from Canonical that can help you easily create VMs (Virtual Machines). This tutorial uses Multipass to create a self-contained Virtual Machine that includes MAAS and an LXD host right on your desktop or laptop.


Inside the VM, Multipass will use LXD and Linux configuration to build a virtual private switch and router, and provide a way to create what are called “nested VMs”, or virtual machines inside the virtual machine made by Multipass. These nested VMs will represent servers that MAAS can provision.

When we’re finished, you’ll be able to log in to the MAAS server running inside the VM on your computer, compose nested VMs using LXD, and then commission and deploy them. It will then be simple to spin up a quick MAAS environment without needing to build a complete real environment.


2. Requirements

You will need:

  • Ubuntu Desktop 18.04 or higher OR Windows with Hyper-V
    (Note: this tutorial has been tested with Ubuntu, but there are reports it works with Hyper V on Windows. Read more about enabling Hyper-V here.)
  • 16 GB of RAM
  • A quad core CPU with virtualisation support (Intel VT or AMD-V)
  • Virtualisation support enabled in the BIOS
  • 30 GB of free disk space

The memory and disk space is required because we will later be launching nested VMs inside our new environment using MAAS and LXD.

3. Install multipass

During this tutorial, we’re going to be entering quite a few commands in a terminal. Open a terminal of your choice, and let’s get started.

First up, let’s install multipass:

sudo snap install multipass

Check whether multipass installed correctly and is functioning by launching an Ubuntu guest and running the following commands:

multipass launch --name foo
multipass exec foo -- lsb_release -a

You should see the following output:


Delete the test VM, and purge it:

multipass delete --purge foo

Congratulations, you’ve just run a test VM with Multipass! Now it’s time to create your MAAS and LXD environment.

4. Check whether virtualisation is working

We now need to check whether virtualisation is working correctly. This is a relatively simple process. In your terminal, run:

sudo apt install cpu-checker

You should see the following output:

Screenshot from 2021-10-13 18-29-37

Assuming your machine supports hardware virtualisation, we are ready to move on and launch MAAS.

5. Launch the MAAS and LXD multipass environment

Launching the MAAS and LXD VM is as simple as the test VM was to launch, except that this time you will pass a cloud-init config file, and a few other parameters for CPU cores, memory, and disk space.

The below command looks a bit long, so let’s break it down:

  • wget will pull down the config file from a Canonical github repository and pipe it to multipass
  • multipass accepts the output from wget as input for the cloud-init parameter

Feel free to check the contents of the cloud-init config file before running this. Copy the entire command below (both lines) and run it:

wget -qO- \
 | multipass launch --name maas -c4 -m8GB -d32GB --cloud-init -

Wait for multipass to finish launching the MAAS and LXD VM. When the command completes, verify that it is running:

multipass list

You should see the following:
Screenshot from 2021-10-13 14-34-35

Here you can see two IP addresses. One belongs to the internal network ( for MAAS and LXD guest VMs to communicate. You can use the other to connect to MAAS from your computer.

The internal network is Take note of the other IP address; you will need it in the following steps. In the above output, that IP address is Later on, we will refer to this IP as <MAAS IP>, but you will need to replace it with yours.

Great work! Now you’re ready to try out MAAS.

6. Log into MAAS

Now that MAAS is running, you need to login and finalise the setup for MAAS by configuring DNS and verifying the installation.

From a browser on your computer, go to:


Don’t worry that it’s not HTTPS - you’re accessing this on your own PC (nobody can eavesdrop).

You should see the MAAS log in page:
Screenshot from 2021-10-13 14-40-37

Log in with the username admin and password admin, and you should be greeted with the welcome screen. DNS in the DNS forwarder field should be prepopulated with, but you can change it if you like to another DNS provider:

Screenshot from 2021-10-13 14-43-39

Scroll down and click the green Continue button. You should then see a screen asking for some SSH keys. Leave the browser window open here, and move to the next step: setting up an SSH key pair.

Screenshot from 2021-10-13 14-46-42

7. Set up an SSH key pair

You need to add an SSH key to MAAS, because MAAS automatically puts SSH public keys on machines when deploying them. This enables you to login to the LXD VMs that we will create later.

We will do this on the multipass VM we created. Multipass allows us to launch a shell on the MAAS VM, so we will create an SSH key pair there. Go back to the terminal you opened earlier:

multipass shell maas

You should now see that you are on a shell inside the MAAS VM:
Screenshot from 2021-10-13 14-52-20
Generate a private public key pair, and give the default answer to all questions:

ssh-keygen -t rsa -b 4096

Screenshot from 2021-10-13 14-58-18

Now display the public key:

cat ~/.ssh/

Select and copy the public key:
Screenshot from 2021-10-13 15-08-52

Now we have the public key, we just need to add it in the MAAS web interface. Go back to your browser. Under the source pulldown, select “Upload”. Paste the key into the public key section, then click the green Import button:

Screenshot from 2021-10-13 15-20-04

Once you’ve imported the public key, the green Go to dashboard button should be clickable. Click it, and you should now see:

Screenshot from 2021-10-13 15-25-27

Awesome, now MAAS has an ssh key loaded, and we’re sitting on the main Machines page in MAAS. Next up, it’s time to verify and explore our MAAS installation.

8. Verify and explore your MAAS and LXD installation

Let’s take a look around our new setup. MAAS might still be downloading some Ubuntu images, getting itself ready to use them to deploy. By default, this is around 1 GB, so depending on your network speed it might take a little while.

First, click the KVM tab up top. You should see a LXD server already set up for you, similar to the following:

Screenshot from 2021-10-13 15-29-49

Second, click the Controllers tab up top. You should see that you have a controller of type rack and region controller, and the status should show a green tick:

Screenshot from 2021-10-13 15-34-11

Now, click the Images tab. If MAAS has finished syncing the Ubuntu images mentioned above, then you should see that the status says “Synced”:

Screenshot from 2021-10-13 15-35-20

If it’s not synced yet, wait for a few minutes and refresh the page.

Once the images are synced, it’s time for some fun – using MAAS to create our first VM guest with LXD!

9. Create a VM guest

Click the KVM tab up top again, and click the MAAS link for the KVM host in the “NAME” column, which should bring you here:

Screenshot from 2021-10-13 15-41-54

Click Compose VM, and you should see:

Screenshot from 2021-10-13 15-47-42

Now fill in the details. For an Ubuntu guest, we need to set RAM, CPU and disk to their recommended values:

  • Set the Hostname field to AwesomeVM1
  • Set the RAM to 6 GB
  • Set the storage to 8 GB
  • Set the CPU cores to 2

When you’re done, scroll down and click the green Compose machine button. Scroll back up and you should see:

Screenshot from 2021-10-13 15-43-18

Notice how the CPU cores, memory, and disk space consumption by your first VM is being tracked by LXD. Note that, if you have space, you can compose more than one VM by repeating this step and providing CPU, memory, and disk space.

Congrats! You’ve now created your first VM guest. We’re almost done!

10. Commissioning and deploying Ubuntu to the VM guest

MAAS should have already started commissioning the machine. When commissioning, MAAS does some testing to make sure everything is fine with the machine. It will run CPU, memory and storage tests, and when it’s done (assuming everything is good), it will show that the machine is in a READY state.

Click the Machines tab up top and you should see your new VM host in the list with a status of Commissioning. It should look like this:

Screenshot from 2021-10-13 15-50-47

Click the machine and you should see more details:

Screenshot from 2021-10-13 15-52-37

Click the Commissioning tab to watch the commissioning progress live.

Screenshot from 2021-10-13 15-53-18

When it’s done, the machine will move into a ready state, and can be viewed from the Machines tab or from within the machine view itself:

Screenshot from 2021-10-13 16-05-29

It’s now time to deploy Ubuntu to the machine! From the Machines tab, tick the AwesomeVM1 tickbox. Then simply click the green Take action button in the top right and click deploy:

Screenshot from 2021-10-13 16-08-18

After clicking deploy, you will see the following screen, click the green Start deployment for machine button:

Screenshot from 2021-10-13 16-12-25

You should see that MAAS starts deploying Ubuntu to the machine. It will take a while to deploy Ubuntu depending on the speed of your computer.

Screenshot from 2021-10-13 16-13-27

When it’s done, assuming everything went well, you should now see the machine status changes to reflect the Ubuntu version installed:

Screenshot from 2021-10-13 16-40-46

Great work - the machine is now ready for us to log in and verify that it is up and running.

Important: take note of the IP address displayed for your AwesomeVM1 machine in the screenshot above. We will refer to this as <AwesomeVM1 IP> in the next step. In our screenshot above, the IP address is, which belongs to the private network created for MAAS and LXD by multipass.

11. Verify the VM guest is up and running

Go back to the terminal you started earlier, which should still be logged in to the multipass shell on your MAAS VM:

Ping your AwesomeVM1 guest:

ping <AwesomeVM1 IP>

You should see ping responses:

Screenshot from 2021-10-13 17-00-56

SSH into the VM guest by running the following command. Accept the authenticity notice:

ssh ubuntu@<AwesomeVM1 IP>

You should see that you are now in a shell on the AwesomeVM1 machine:

Screenshot from 2021-10-13 17-03-14

Great work!

Try pinging something on the internet from the machine:


Again, you should see ping responses:

Screenshot from 2021-10-13 17-04-24

That’s it! We’ve successfully created and deployed a VM inside our multipass VM using MAAS and LXD.

12. That’s all folks!

Fantastic work! We now have our own MAAS and LXD environment!

You’ve learned:

  • How to install a MAAS and LXD playground environment using Multipass
  • How to create a VM guest
  • How to setup MAAS with an SSH key
  • How to quickly verify whether MAAS and LXD are operating correctly
  • How to create a VM guest
  • How to deploy Ubuntu using MAAS to a machine
  • How to log in to the VM guest and verify it is functioning

Play around creating some more VMs, but be aware of your CPU, memory, and storage limitations. If you like, you can experiment with deleting machines from the Machines tab and recreating VMs in the KVM tab.

Next steps

If you want to get a bit more advanced, you can try editing the maas.yml file and altering how much storage LXD assigns. You can also change the multipass command to start your MAAS VM, adding more CPU cores, memory and disk. Note that you need to ensure that the disk space you assign using multipass is large enough to accommodate both MAAS and the LXD storage.

To learn more about bare metal provisioning and MAAS, try our ebook.

Learn more about MAAS at Perhaps you would like to build a real physical environment for MAAS and LXD?