Maas安装和使用

2024-02-29
1分钟阅读时长

postgresql配置

配置主机名为maas

hostnamectl set-hostname maas

/etc/hosts 也修改maas为

127.0.0.1 maas

安装postgresql

apt install -y postgresql
export MAAS_DBUSER=maas
export MAAS_DBPASS=maas
export MAAS_DBNAME=maas
sudo -i -u postgres psql -c "CREATE USER \"$MAAS_DBUSER\" WITH ENCRYPTED PASSWORD '$MAAS_DBPASS'"
sudo -i -u postgres createdb -O "$MAAS_DBUSER" "$MAAS_DBNAME"
echo "host $MAAS_DBNAME $MAAS_DBUSER 0/0 md5" >> /etc/postgresql/12/main/pg_hba.conf

/etc/postgresql/12/ 这里不同版本系统可能会不一样

maas安装

snap安装maas

snap install --channel=3.4 maas
systemctl disable --now systemd-timesyncd

初始化maas

其中ip请修改为部署maas主机的ip

root@maas:~# maas init region+rack --maas-url http://192.168.1.2:5240/MAAS --database-uri "postgres://$MAAS_DBUSER:$MAAS_DBPASS@$HOSTNAME/$MAAS_DBNAME"
MAAS has been set up.

If you want to configure external authentication or use
MAAS with Canonical RBAC, please run

  sudo maas configauth

To create admins when not using external authentication, run

  sudo maas createadmin

To enable TLS for secured communication, please run

  sudo maas config-tls enable

验证maas状态

root@maas:~# maas status
bind9                            RUNNING   pid 5103, uptime 0:11:31
dhcpd                            STOPPED   Not started
dhcpd6                           STOPPED   Not started
http                             RUNNING   pid 5429, uptime 0:11:12
ntp                              RUNNING   pid 5231, uptime 0:11:28
proxy                            RUNNING   pid 5511, uptime 0:10:51
rackd                            RUNNING   pid 5107, uptime 0:11:31
regiond                          RUNNING   pid 5109, uptime 0:11:31
syslog                           RUNNING   pid 5360, uptime 0:11:17

配置超管账号

root@maas:~# maas createadmin --username admin --password admin123 --email [email protected]

导出admin密钥

root@maas:~# maas apikey --username admin > /root/admin-api-key

maas配置

image-20240229093539974

这里使用阿里DNS

源用清华源

https://mirrors.tuna.tsinghua.edu.cn/ubuntu

https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports

镜像配置

选择maas.io连接下载镜像

image-20240229093857342

免密登陆配置

image-20240229095838739

主界面

image-20240229095944403

配置dhcp

设置网段起始

image-20240229100218847

image-20240229100153941

vlan

image-20240229100446881

image-20240229100344842

image-20240229100415724