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
-
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
-
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
-
Install snap package
sudo snap install lxd
-
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 withlxc config set core.https_address :8443
Notice the new local network bridge, created by default, withlxdbr0
name. -
Disable LXD’s built-in DHCP server:
lxc network set lxdbr0 ipv4.dhcp=false
MAAS Installation
-
Install snap package:
sudo snap install maas
-
Initialise using PostgreSQL provisioning database and credentials
sudo maas init region+rack --database-uri postgres://maas:password@localhost/maasdb
-
Make a note of the URL this command returns (similar to the following); you’ll need it later:
http://<ip-address>:5240/MAAS
-
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.
-
Access MAAS with the URL and credentials from previous step.
-
[ Connectivity > DNS forwarder ], set a server, such as
8.8.8.8
.
Save and Continue -
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 -
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
-
Identify the LXD bridge IP address:
ip addr show lxdbr0
-
In MAAS, go to [ Networking > Subnets ] and identify the VLAN for that subnet.
-
Select the VLAN, by clicking its value under the VLAN column. It may have the
untagged
value. -
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:
-
Select [ KVM > LXD > Add LXD host ].
-
Enter a Name for the KVM host.
-
Optionally, select a non-default Zone, or a non-default Resource pool.
-
Enter the LXD address as the gateway address of the bridge for that LXD instance.
From previous extractedlxdbr0
network, pick the first IP value.
As for the port, we will use the one initialised on LXD setup, by default8443
.
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 -
Verify Generate new certificate is selected and Next.
-
Verify Add trust to LXD via command line is selected, and run the shell command. Optionally you can download the certificate.
-
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.
-
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.
-
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:
-
Select [ KVM > LXD > previously created VM host > Add VM ].
-
You can use the defaults and just press Compose machine.
Alternatively, go through the optionals. -
Optionally, enter the VM name.
-
Optionally, select Use any available core(s) or Pin VM to specific core(s), as needed. Enter specific core identities as appropriate.
-
Optionally, enter the RAM required.
-
Optionally, select Show advanced if you want to edit the Domain, Zone, Resource pool, or Architecture. Make those changes as needed.
-
Optionally, define Interfaces.
-
Optionally, configure Storage configuration, or Add disks.
-
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.