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.
sudo apt update
sudo apt install snapd lxd lxd-client python3-lxc python3-openstackclient
sudo snap install maas
sudo apt install postgresql postgresql-contrib
sudo su - postgres
psql
CREATE USER maas WITH PASSWORD 'password';
CREATE DATABASE maasdb OWNER maas;
\q
exit
/etc/postgresql/12/main/pg_hba.conf
, adding a line like the following, to allow the MAAS user to connect: sudo vi /etc/postgresql/12/main/pg_hba.conf
host maasdb maas 0/0 md5
sudo maas init region+rack --database-uri postgres://maas:password@localhost/maasdb
http://<ip-address>:5240/MAAS
sudo maas createadmin
MAAS is now installed.
$API_HOST
is the MAAS URL: http://${API_HOST}:5240/MAAS
Log in by using the login information you created when initialising MAAS.
In the web UI, go to Settings > General and set a forward DNS server, such as “8.8.8.8”.
Under Images, select the Ubuntu release to sync; you can usually accept the default.
Under Accounts, import your SSH public key from Launchpad or GitHub, or upload your existing public key. Follow the on-screen instructions.
Review remaining configuration options (proxy usage, NTP, and so on).
MAAS can now manage and provision nodes.
ip addr show lxdbr0
In MAAS, go to Subnets and identify the VLAN for that subnet.
Select the VLAN and configure DHCP with the bridge IP as the gateway.
MAAS now provides networking and DHCP for provisioning LXD virtual machines.
sudo snap install lxd
sudo lxd init
Choose appropriate options for networking, storage pools, and so on.
lxc network set lxdbr0 ipv4.dhcp=false
Create a LXD VM host with a MAAS-generated certificate:
Select KVM > LXD > Add KVM.
Enter a Name for the KVM host.
Optionally, select a non-default Zone.
Optionally, select a non-default Resource pool.
Enter the LXD address as the gateway address of the bridge for that LXD instance. For example, if lxdbr0
has address 10.4.241.0
, the default gateway address is 10.4.241.1
.
Select Generate new certificate.
Select Next.
Select Add trust to LXD via command line.
Copy the bash command and certificate from the text box.
In a terminal, paste the copied command and make sure that it runs.
Select Check authentication. You’ll switch screens; if all goes well, you’ll see 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 Next. 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 virtual machine from the MAAS UI:
Select KVM > LXD > desired VM host > Add VM.
Optionally enter the VM name.
Select Use any available core(s) or Pin VM to specific core(s), as needed. Enter specific core identities as appropriate.
Enter the RAM required.
Select Show advanced if you want to edit the Domain, Zone, Resource pool, or Architecture. Make those changes as needed.
Optionally Define interfaces.
Optionally Add disks.
Select Compose machine to create the virtual machine.
You can switch from here to the Machine list to watch the commissioning process in action.
To acquire (or allocate) your new machine so that only you can deploy it, select your new VM when “Ready” > Take action > Allocate > confirm. MAAS is now ready to deploy your newly-created virtual machine.
To deploy your VM directly from MAAS with the default options, select your allocated VM > Deploy > Deploy. The VM’s status will change several times as MAAS steps through the process. When done, the status becomes the name of the deployed operating system (e.g. ‘Ubuntu 18.04 LTS’).
SSH into deployed machines with username Ubuntu
. Feel free to explore the deployed VM.
Dive deeper into MAAS features and in the explanation, how-to guides, and reference sections.