This tutorial provides an in-depth walkthrough of installing, configuring, and preparing MAAS to manage your physical server infrastructure.
Installing MAAS
To install MAAS on your Ubuntu host:
-
Update your package index and install dependencies:
sudo apt update sudo apt install snapd lxd lxd-client python3-lxc python3-openstackclient
-
Install the MAAS snap package:
sudo snap install maas --classic
-
Install the PostgreSQL database:
sudo apt install postgresql postgresql-contrib
-
Switch to the postgres user and open the PostgreSQL shell:
sudo su - postgres psql
-
Create a database user for MAAS:
CREATE USER maas WITH PASSWORD 'password';
-
Create the MAAS database:
CREATE DATABASE maasdb OWNER maas;
-
Exit PostgreSQL and return to your regular user:
\q exit
-
Edit
/etc/postgresql/12/main/pg_hba.conf
, adding a line like the one below, to allow the MAAS user to connect:sudo vi /etc/postgresql/12/main/pg_hba.conf host $MAAS_DBNAME $MAAS_DBUSER 0/0 md5
-
Initialize MAAS, specifying the PostgreSQL URL:
sudo maas init region+rack --database-uri postgres://maas:password@localhost/maasdb
-
Visit the web UI and create your admin account.
MAAS is now installed!
Configuring MAAS
After installing, complete further configuration:
-
Access MAAS at this address, where
$API_HOST
is the MAAS URL which was generated earlier:http://${API_HOST}:5240/MAAS
Log in using the login information you created when initializing 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 config options like proxy usage, NTP, etc.
MAAS can now manage and provision nodes.
Setting up LXD
To manage LXD containers alongside physical servers:
-
Install the LXD snap:
sudo snap install lxd
-
Initialize the LXD configuration:
sudo lxd init
Choose appropriate options for networking, storage pools, etc.
-
Disable LXD’s built-in DHCP server:
lxc network set lxdbr0 ipv4.dhcp=false
Configuring Networking and DHCP
Finally, configure networking and DHCP:
-
Identify the LXD bridge IP address:
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.