To make the setup of a MAAS development environment super simple. Think of this as a one click installer.
- Ubuntu (maybe Debian)
sudoand the ability to run commands as root- To use MAAS a decent amount of RAM would be good (> 8GB)
- An authentication key setup on Github for your local machine (see GitHub docs)
In the best case LXD is not configured on your system. If it isn't, run the following commands and restart your machine:
sudo adduser $USER lxd
newgrp lxdHowever, if you have configured LXD and have running
containers and network configurations, this is not a problem but make sure
that the following names/network ranges are not yet used by LXD (or change values in
config.sh).
- a profile in LXDs default project called
$MAAS_CONTAINER_NAME - two networks named
maas-ctrlandmaas-kvm- these networks will use the IP ranges
$MAAS_CONTROL_IP_RANGEandMAAS_MANAGEMENT_IP_RANGE
- these networks will use the IP ranges
- Edit the
config.shfile according to your needs. - Run this to see your options
./setup-dev-env.sh- Run this to start
./setup-dev-env.sh --okIf you would like to tear down your MAAS dev environment completely, do the following:
- remove everything from LXD (e.g. containers, profiles, networks, ...) for all projects
- you can use LXD Delete All for this job
- remove your libvirt network definitions (
virsh net-destroyandvirsh net-undefinefor all networks) - delete (or move) your current maas source code
This script was carefully crafted and does not contain any destructive commands. Still it may install dependencies that might break your system.
The script was tested on Ubuntu 22:10 and 24.04 LTS.
The script will:
- DISABLE YOUR UFW FIREWALL (to make sure lxd connections work)
- Install git, make, lxd, snapcraft, libvirt with qemu
- Clone the source code and (if configured) add a branch for your launcpad account
- Setup LXD to have a MAAS development container, profiles and networks
- Setup bridges so that MAAS can reach your network
- Create
MAAS_MACHINE_COUNTempty LXD VMs on themaas-kvmnetwork and add them to MAAS as machines using thelxdpower driver- The VMs live in a dedicated LXD project,
MAAS_MACHINE_PROJECT, with a profile of the same name. The project shares thedefaultproject's networks. - An RSA client certificate is generated in
.lxd-power/(git-ignored) and trusted by your local LXD, restricted toMAAS_MACHINE_PROJECT. The certificate and key are copied into the MAAS container only while the machines are added to MAAS (as power parameters) and removed afterwards.
- The VMs live in a dedicated LXD project,
Basically the script mimics the steps described in this discourse post and configures your maas-dev host to be able to connect to your local LXD.
The script will stop on any error, so please be sure to skip stages, if you have already done them.
You can skip some of those stages using the -sX arguments. Run ./setup-dev-env.sh --help to see your options.
If you need MAAS to accept a self-signed SSL certificate, you must add the certificate (in PEM format) to the trusted CAs within the lxd container. You can do this with the -c or --ca-crt option, as such:
./setup-dev-env.sh --ok -c /path/to/cert.crtBump MAAS_MACHINE_COUNT in config.sh and skip every other stage. Existing VMs and machines are reused, so only the new ones get created:
./setup-dev-env.sh -su -sd -si -sn -sp -sc -ss -sl -sr --ok