ubuntu18.04 maas

参考文档:

《使用IPMI远程控制管理DELL R710服务器》

《Juju-maas 环境搭建》

《MAAS+JUJU+CONJURE-UP全自动部署OPENSTACK》

《官方文档 Install MAAS》
《官方文档MAAS Documentation》
《MAAS installation from packages》

《官方文档 jaas》
《官方文档Install Juju》
《Installing Juju》

《官方文档Ubuntu18.04,OpenStack Charms Deployment Guide》
《官方文档Conjure-up is magic!》
《官方文档What is conjure-up》

《canonical》

《裸机云快速部署利器Ubuntu MAAS:单机安装及测试系列教程第一篇》
《裸机云快速部署利器Ubuntu MAAS:单机安装及测试系列教程第二篇》
《裸机云快速部署利器Ubuntu MAAS:单机安装及测试系列教程第三篇》
《Ubuntu集群-使用MAAS开始裸机安装》
《Ubuntu MAAS - Custom Ubuntu 16.04 Images [closed]》

前置设置:
配置node服务器ipmi,以确保maas可以远程开关机node服务器。dell r系列是pxe使用第一个网口,且ipmi也使用第一个网口,ipmi会从dhcp获得一个网络地址,pxe也会dhcp一个地址。

1 Set up your hardware
1 安装硬件
You need one small server for MAAS and at least one server which can be managed with a BMC. It is recommended to have the MAAS server provide DHCP and DNS on a network the managed machines are connected to.

你需要用一个小服务器安装maas,并且最少又一台可以用BMC管理的服务器。推荐使用MAAS服务器提供DHCP和DNS去管理联接的网络。

2 Install Ubuntu Server
2 安装ubuntu服务器
Download Ubuntu Server 18.04 LTS and follow the step-by-step installation instructions on your MAAS server.

下载 Ubuntu 服务器 18.04 LTS,并 在你的MAAS 服务器上的按照分步安装说明进行操作。

修改为国内源并修改host,以提高升级速度和下载映像速度。

sudo su - root
mv /etc/apt/sources.list /etc/apt/sources.list.bak
touch /etc/apt/sources.list


#echo “content” >> 文件名
echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse" > /etc/apt/sources.list
echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse" >> /etc/apt/sources.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse" >> /etc/apt/sources.list
echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse" >> /etc/apt/sources.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse" >> /etc/apt/sources.list
echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse" >> /etc/apt/sources.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse" >> /etc/apt/sources.list
echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse" >> /etc/apt/sources.list

apt update -y  && apt -y upgrade 

cp /etc/hosts /etc/hosts.old
echo 91.189.95.83 ppa.launchpad.net >> /etc/hosts
echo 91.189.88.136 images.maas.io >> /etc/hosts
echo 91.189.91.45 maas.io >> /etc/hosts
netplan apply

3 Install MAAS
3 安装MAAS

sudo apt update
sudo snap install maas
#sudo apt install maas

4 Create admin user
4 创建admin用户
Create your admin credentials by typing
敲入以下命令创建你的admin证书

sudo maas init

Log in to the MAAS UI at http://<your.maas.ip>:5240/MAAS/
登陆MAAS界面 http://<your.maas.ip>:5240/MAAS/

5 Complete the first user configuration journey
5 完成第一次用户配置之旅
Follow the instructions on screen to complete the first installation of MAAS. We recommend using the default values unless your installation has different requirements.

By the end of the journey you should have the following configured;

Region name (MAAS name)
Ubuntu archive, Ubuntu extra architectures
Ubuntu images(https://mirrors.tuna.tsinghua.edu.cn/ubuntu-cloud-images/daily/streams/v1/index.json)
SSH keys (for currently logged in user)
按照屏幕上的说明完成 MAAS 的第一次安装。我们建议使用默认值,除非您的安装有不同的要求。注:archive我用的清华源:
https://mirrors.tuna.tsinghua.edu.cn/ubuntu/。但是下载映像时,还是从maas.io下载,会非常慢。用了两天才把18.04的64位映像下载完毕。下载映像时,可以把后续的步骤做了。
nethogs
lsof -p 2092 -nP | grep TCP

在旅程结束时,您应该已配置以下内容;

区域名称(MAAS 名称)
UBUNTU档案, UBUNTU额外的架构
UBUNTU IMAGE
SSH密钥(对于当前登录的用户)注:ssh密钥不建议使用lauchupad账户。建议在maas服务器下直接生成。
在这里插入图片描述
6 Turn on DHCP
6 打开DHCP
Go to the “Subnets” tab, and select the VLAN for which you want to enable DHCP. From the “Take action” button select “Provide DHCP”.

Set the Rack controller that will manage DHCP.
Select the subnet where to create the DHCP Dynamic range on.
Fill in the details for the dynamic range.

到选项卡 “Subnets” ,选择VLAN中当前所用的,将开启DHCP。选中 “Take action” 按钮,选择 “Provide DHCP”。

注:在pxe起作用的子网,需要配置网关,如不配置,在maas服务器中无法发现node。在node节点会显示类似disable enlist in maas server的字样。

设置 Rack controller,将管理 DHCP。
选择subnet,将创建 DHCP 动态范围。
填写dynamic range详细信息。
在这里插入图片描述

7、创建ssh key
MAAS在安装服务器节点时,会将存储的key注入到节点中,以后从MAAS controller上可以直接登录到machine中(账号Ubuntu,无密码)。

注:开始的时候我建立了个admin账户,使用的lauchpad账户的ssh key,然后无法登陆到使用maas安装的node,因为用户名密码不对。后来重新创建了个账户yunwei,并在服务器里使用ssh-kengen创建的key,实现了从maas服务器使用ssh ubuntu@$node-ipadd免密登陆。

创建key:

ssh-keygen -t rsa -b 2048

然后 vi ~/.ssh/id_rsa.pub 拷贝进去。如果里面已经有内容,可以直接拷贝下来。

重要:
点击账户名(上面的方法为admin),将上面的key内容import到ssh key中。
这个操作需要在deploy节点之前进行。

8、列出和部署servers
Now MAAS is ready to enlist and commission machines.

Set all the servers to PXE boot
Boot each machine once. You should see these machines appear in MAAS
If your machines do not have a IPMI based BMC, proceed to edit them and enter their BMC details
Select all the machines and “Commission” them using the “Take action” button
When machines have a “Ready” status you can start deploying

到Images选项卡里,选择需要部署的镜像,MAAS将会自动启动下载。将会需要较长的时间。
注:为了加快下载进度,需要更改host文件以加快下载速度。

(可选定制化,选择清华源,https://mirrors.tuna.tsinghua.edu.cn/ubuntu-cloud-images/daily/streams/v1/index.json)

等MAAS下载完系统镜像,就准备好部署 machines了。

其它物理机设为网络启动(PXE boot),把其它启动方式关闭。
启动后在MAAS中machines选项卡可以看到,状态为New。
如果machines 没有 IPMI based BMC, proceed to edit them and enter their BMC details
选择 machines ,选择“Take action”为 “Commission”。
当machines 状态变为 “Ready”,然后再次执行 “deploy”,可以选择安装的操作系统版本。
注:在ready后,deploy前,点击interface选项卡,在右侧action选项下进入物理配置,可以配置node网卡地址为静态。但在commission状态可以配置网卡,但是不会生效。在deploy状态时,无法配置网卡为静态等分配形式。

在这里插入图片描述

9、登录到节点服务器
上面的操作结束后,从maas controller机器使用 ssh ubuntu@$node_IP_address 登录到节点。

用户名为 ubuntu,免密。
然后可以使用Ansible可以集中地控制多个节点,批量地执行ssh命令。

如果

猜你喜欢

转载自blog.csdn.net/m0_49212388/article/details/108579434