CentOS 8 via MaaS
In my opinion, CentOS is one of the best Systems for HPC applications. A Problem for large scale HPC systems is to install CentOS to many Systems in a simple way.
MaaS (Metal as a Service) solves this problem by providing a solution that is easy to understand and simple to install. MaaS is software from canonical and was intended to install Ubuntu. It also features the ability to install CentOS 6 and CentOS 7. Canonical allows the MaaS administrator to obtain CentOS 6/7 images from their servers.
As of the time of writing this, there is no option to install CentOS 8. This might be because MaaS images are usually built based on cloud images made for VMs. I am not aware of any prepared image for CentOS 8 in qcow2 or any other VM disk format.
With a little hacking, this can all be implemented manually. Since the code for the CentOS support is already part of curtin (the underlying installer of MaaS) there is just a minor addition needed to get this up and running.
MaaS installation
NOTE: I tested everything with Ubuntu 19.10 which installs MaaS 2.6.0.
First, install MaaS. I don’t want to go into detail here. Everything is well documented on https://maas.io/install
After you are finished with installation I’d suggest you obtain CentOS 7 from the image tab and install a Machine in order to test the MaaS installation.
CentOS 8 image
Obtain the CentOS 8 image from https://www.centos.org/download/.
The provided images are very large iso files and not really suited for MaaS deployment. Now we need to generate something smaller.
On an Ubuntu 18.04 system, you can simply install libvirt-bin and virt-manager to create a VM and install the iso in it. If you think about doing the this in a cli way: The CentOS installer is a graphical installer and you will anyway need something that displays this thing.
Steps in virt-manager:
- Create a new VM
- tell it to install from the iso file
- set cpu and mem settings
- go to custom disk settings and change the format to raw (12 GiB will suffice)
Steps in the CentOS installation:
- choose to install CentOS
- in the software selection switch to the minimal installation profile
- THIS IS CRUCIAL: in the installation destination settings choose storage configuration custom and click on done
- change the partitioning scheme to standard partition
- click on + and add the mountpoint / click on “add mount point”
- click on done (CentOS will now tell you that you dont have a swap partition you can ignore this)
- finish the configuration and go to installation
- after you finished: STOP THE MACHINE
Software installation and MaaS image preparation:
- get the path to your VMs raw image
- mount the disk to the system by
sudo losetup -f -P path/to/your/vm/image- get the loop device name via:
sudo losetup -l | grep path/to/your/vm/image- create a mount point:
sudo mkdir /vm- mount the first partition via:
sudo mount /dev/loopXp1 /vm- bind mount /dev /sys and /proc (needed for rpms to work):
sudo mount --bind /dev /vm/dev
sudo mount --bind /sys /vm/sys
sudo mount --bind /proc /vm/proc- chroot into your installation:
sudo chroot /vm- install cloud-init (needed for MaaS):
yum install -y cloud-init- exit the chroot:
exit- unmount /dev /sys and /proc
sudo umount /vm/dev
sudo umount /vm/sys
sudo umount /vm/proc- create an archive of the rootfs via:
cd /vm && sudo tar czvf ~/centos8.tgz .The image that we generated has to be uploaded to the maas server. This can be done from the command line. But first log in:
maas login your.user http://<maasserver>:5240/MAAS ‘user:credentials’Now upload the image:
maas your.user boot-resources create name=centos/centos80 title=”CentOS 8" architecture=amd64/generic content@=~/centos8.tgzNow we are almost done. MaaS should already show your new image as being uploaded and one could, in theory, deploy a system.
Curtin
In “/usr/lib/curtin/helpers/common” there are two case statements at the end of the file that differentiates between CentOS 6 and 7 but version 8 is missing. Simply putting a “|8” after version 7 in the case statements solves this.
diff — git a/helpers/common b/helpers/common
index 5928150..7146b06 100644
— — a/helpers/common
+++ b/helpers/common@@ -694,7 +694,7 @@ install_grub() {x86_64)case $rhel_ver in6) grub_name=”grub”;;- 7) grub_name=”grub2-pc”;;+ 7|8) grub_name=”grub2-pc”;;*)error “Unknown rhel_ver [$rhel_ver]”;return 1;@@ -885,7 +885,7 @@ install_grub() {centos|redhat|rhel)case $bootver in6) grubcmd=”grub-install”;;- 7) grubcmd=”grub2-install”+ 7|8) grubcmd=”grub2-install”grubpost=”grub2-mkconfig -o /boot/grub2/grub.cfg”;;esac;;
Now you can deploy a machine with CentOS 8. If you follow the installation log you might realize, that the system is recognized as rhel and not centos but it does not seem to be a big problem.
