This post is the part 2 of the CBL-Mariner blog series. If you’ve not read Part 1 yet please do so here.
CBL-Mariner philosophy is you only need a small core set of packages(RPM Based) on top of CBL core to address the needs of cloud & edge computing.
What’s in it?
It shares major components from,
- VMWare’s Photon OS project for SPEC files
- The Fedora Project for QT, DNF etc
- Linux from scratch for SPEC and for simplified installation
- Open mamba for SPEC files
- GNU FSF Core compilers and utilities
- And finally requires Ubuntu 18.04 as the build environment to create CBL mariner binaries and to bake an ISO
How to install it?
CBL-Mariner is open source released under GNU GPL, LGPL, MIT License & Apache License.
- It has its own repo under Microsoft’s GitHub organization.
- No ISOs or images of Mariner are provided
- The repo has instructions to build them on Ubuntu 18.04.
- It can be deployed on VMware, Hyper-V or Virtual Box
- It doesn’t include Desktop aka GUI
How does it look like?
- Its completely based on command line(CUI)
- Boots very quickly due to light-weight nature
- Runs with very minimal or nominal memory foot print
- CBL-Mariner package system is RPM-based
- The package management system uses both dnf and tdnf (Tinydnf)
- It has two package repositories, base and update
- Around 3300 packages are available between both repositories.
How does it operates?
Apart from DNF CBL-Mariner also supports an image-based update mechanism for atomic servicing and rollback using RPM-OSTree, rpm-ostree is an open source tool based on OSTree to manage bootable, immutable, versioned filesystem trees. The idea behind rpm-ostree is to use a client-server architecture to keep Linux hosts updated and in sync with the latest packages in a reliable manner.
This is not a regular Linux distro that you think, which you’ll try to install on the hardware or as a virtual machine and install necessary applications on it and start using it like you use Ubuntu, Fedora, Arch etc. No matter if you’re a professional developer, sys admin or a mere hobbyist, you can easily build custom CBL-Mariner images and play around. However, If you’re not a faint hearted person and have previous exposure to Makefiles, Make command, rpm build and Linux proficiency it’ll be easy for you. There are prerequisites listed in it’s GitHub page that roughly include Docker, RPM tools, ISO build tools and Golang, amongst others to setup an environment on Ubuntu 18.04(recommended) for building an ISO.
Finally, how do you use it?
CBL-Mariner doesn’t have any ISO image available by default. The GitHub page provides a quick start guide to build an ISO. There is another description which provides details on building a custom CBL-Mariner ISO and/or image.
There are couple of prerequisites needed to build your ISO. First thing we require is an Ubuntu 18.04 system. As per the GitHub pages of CBL-Mariner all the requirements are tested and validated for Ubuntu 18.04.
We’ll now check on the quick start guide as an initial step and if you’re interested to do a custom build you can do so. Quick build will take approximately 20 to 30 minutes and a custom build has taken a little over 3 hours.
I’ve tested this build in AWS with a t2.medium EC2 instance having 50 Gig disk. I have bumped up to 50 Gig because I build the quick one as well as the custom image. Custom build requires rpm packages to be rebuild and it’ll consume some space in your file system.
# Install required dependencies.
sudo apt -y install make tar wget curl rpm qemu-utils genisoimage python-minimal bison gawk parted gcc g++# Recommended but not required: `pigz` for faster compression operations.
sudo apt -y install pigz# Install Docker. $ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh $ sudo usermod -aG docker $USER# I've explicitly installed golang from the tar ball
$ wget https://dl.google.com/go/go1.16.7.linux-amd64.tar.gz $ tar zxvf go1.16.7.linux-amd64.tar.gz $ sudo mv go /usr/local/bin $ export GOROOT=/usr/local/go $ export PATH=$GOPATH/bin:$GOROOT/bin:$PATH $ go version - To test the installation
For the build to work we need to create a symbolic link of go binary to /usr/bin
$ sudo ln -s /usr/local/go/bin/go /usr/bin/go
Now we can clone the CBL-Mariner repository and start our build.
$ git clone https://github.com/microsoft/CBL-Mariner.git
$ git checkout 1.0-stable
$ cd toolkit
$ sudo make image REBUILD_TOOLS=y REBUILD_PACKAGES=n CONFIG_FILE=./imageconfigs/full.json
I’ve faced lot of issues and errors while building with non stable branches/tags. If you are comfortable with bleeding edge releases, you can get your hands dirty with that. Once the build is completed you can find your image in the out directory.
$ cd ../CBL-Mariner/out/images/full/
$ ls -lh full.1.0.20210813.0520.iso
A quick view of the build I’ve done is provided in the below video.
Now that we have the ISO image, we can install CBL-Mariner on a virtual machine. To do this, I’m going to use Oracle VirtualBox, which is free. If we have any other virtualization tool we can use that as well.
Steps to Follow:
- Open VirtualBox.
- Click on the button New to create a new VM.
- Now start the virtual machine creation wizard.
- Put the name we want
- Choose “Linux”, and version “Linux 2.6/3.x/4.x (64-bit)”. And press next.
- Follow the wizard and chose the default
- For CBL-Mariner we must configure at least 1 CPU, 1GB of RAM, and 8GB of disk.
- Go to next until completing the wizard.
- Now that we are back on the main VirtualBox screen
- we can right-click the entry that appears with the name we have given it and then select Configuration on the menu.
- we can also select the entry and click the upper Settings button.
- Go to Storage, and from there on the icon of the optical disk (Empty) we have to click on Optical Drive and choose “Select a disk file” to be able to load the ISO image. And in the browser that will appear, select where we have the ISO that we generated in the previous step.
- It’s time Start the virtual machine with CBL-Mariner.
Once we have started the virtual machine, it will start up and after a few moments it will show we a menu to installation. The steps we must follow are:
- Choose the option “Graphical Installer” for graphical installation. There are also options for text mode, but the graphic is better. And once selected, press Next. [we have to move through the menu with the keyboard arrows and ENTER to select]
- Now we will see an installer very similar to that of any other distro. In the Installation Type menu: we have to choose «CBL-Mariner Full » for full installation. In any case, both in Full and Core, as it hardly includes packages, it will be fast.
- The next screen is the license terms to accept.
- Then comes the assistant hard drive partitioning. There we have to create the necessary partitions or leave the ones that come by default.
- Turn to choose the hostname, as well as the username and password. It’s free text for hostname
- Please provide a complex password with combination of CAPITAL, small, Number & Special Characters
- CBL-Mariner now begins the actual installation. Will start to install packages. And when it’s done, reboot the virtual machine.
- When we start we will see the Login, where we have to put the login data (name and password).
- Now we use CBL-Mariner as we would with any server distro, without a GUI
Thanks to all who have taken time to go through this blog. Hope this helps you to try building and installing CBL-Mariner the latest addition to Linux family.