Install prerequisites here.
From a bash terminal window, clone the CBL-Mariner Repository and check-out a stable build.
# Clone the CBL-Mariner repo
git clone https://github.com/microsoft/CBL-Mariner.git
cd CBL-Mariner
# Sync to the latest stable build
git checkout 2.0-stable
The following builds a bootable, VHDX or VHD CBL-Mariner image from precompiled RPMs in the CBL-Mariner package repository at https://packages.microsoft.com/cbl-mariner/2.0/prod/.
No user account is provisioned by default. To sign-in to these images, the sample meta-user-data.iso image must also be built and installed in your VM's CD drive. The cloud-init service will detect the iso and provision a user account and password.
Build a VHD or VHDX Image
# Switch to the toolkit folder
cd toolkit
# Build VHDX Image
# Image is placed in ../out/images/core-efi
sudo make image REBUILD_TOOLS=y REBUILD_PACKAGES=n CONFIG_FILE=./imageconfigs/core-efi.json
# Build VHD Image
# Image is placed in ../out/images/core-legacy
sudo make image REBUILD_TOOLS=y REBUILD_PACKAGES=n CONFIG_FILE=./imageconfigs/core-legacy.json
Build the cloud-init configuration image
Note that the cloud-init configuration file does not build by default. You will need to edit it to set a username and password or SSH Key. The file is located in ./resources/assets/meta-user-data/user-data.
# Build the cloud-init configuration image
# The output image is ../out/images/meta-user-data.iso
sudo make meta-user-data
Copy VHD(X) and ISO Images to Your VM Host Machine
Copy your binary image(s) to your VM Host Machine using your preferred technique.
Create VHD(X) Virtual Machine with Hyper-V
- From Hyper-V Select Action->New->Virtual Machine.
- Provide a name for your VM and press Next >.
- For VHD select Generation 1. For VHDX select Generation 2, then press Next >.
- Change Memory size if desired, then press Next >.
- Select a virtual switch, then press Next >.
- Select Use an existing virtual hard disk, then browse and select your VHD(X) file.
- Press Finish.
[Gen2/VHDX Only] Fix Boot Options
- Right click your virtual machine from Hyper-V Manager
- Select Settings....
- Select Security and under Template: select Microsoft UEFI Certificate Authority.
- Select the SCSI Controller from the Hardware panel.
- Select DVD Drive and press Add.
Mount the Meta-User-Data.Iso Image
- Right click your virtual machine from Hyper-V Manager
- Select Settings.... choose DVD Drive and press Add.
- Select the DVD Drive. For Gen1/VHD Images, this is nested under IDE Controller 1. For Gen2/VHDX Images, this is nested under SCSI Controller.
- Select Image File: and browse to the meta-user-data.iso file.
- Select Apply to apply all changes.
Boot and Sign-In to your VHD
- Right click your VM and select Connect....
- Select Start.
- Wait for CBL-Mariner to boot to the login prompt, then sign in with the username and password you provisioned in the meta-user-data.iso above.
The following builds a bootable ISO image from precompiled RPMs in the CBL-Mariner package repository at https://packages.microsoft.com/cbl-mariner/2.0/prod/.
# Switch to the toolkit folder
cd toolkit
# Image is placed in ../out/images/full
sudo make iso REBUILD_TOOLS=y REBUILD_PACKAGES=n CONFIG_FILE=./imageconfigs/full.json
Copy ISO Image to Your VM Host Machine
Copy your binary image(s) to your VM Host Machine using your preferred technique.
Create VHD(X) Virtual Machine with Hyper-V
- From Hyper-V Select Action->New->Virtual Machine.
- Provide a name for your VM and press Next >.
- Select Generation 1 (VHD) or Generation 2 (VHDX), then press Next >.
- Change Memory size if desired, then press Next >.
- Select a virtual switch, then press Next >.
- Select Create a virtual hard disk, choose a location for your VHD(X) and set your desired disk Size. Then press Next >.
- Select Install an operating system from a bootable image file and browse to your CBL-Mariner ISO.
- Press Finish.
[Gen2/VHDX Only] Fix Boot Options
- Right click your virtual machine from Hyper-V Manager
- Select Settings...
- Select Security and under Template: select Microsoft UEFI Certificate Authority.
- Select Firmware and adjust the boot order so DVD is first and Hard Drive is second.
- Select Apply to apply all changes.
Boot ISO
- Right click your VM and select Connect....
- Select Start.
- Follow the Installer Prompts to Install your image
- When installation completes, select restart to reboot the machine. The installation ISO will be automatically ejected.
- When prompted sign in to your CBL-Mariner using the user name and password provisioned through the Installer.