Install using clr-installer and a configuration file

In addition to the interactive GUI and text-based modes, clr-installer also supports an unattended mode where you simply provide it a YAML configuration file.

This guide shows you two examples of how to use its unattended mode.

Prerequisites

For installation onto bare metal, ensure that your target system supports these requirements:

Download and make bootable USB of the live server image

See Create a bootable USB drive using Etcher*.

Example 1: Fresh installation onto bare metal

This example uses a YAML configuration file to perform a new installation.

  1. Boot up the Clear Linux OS Live Server USB thumb drive.

  2. Select Clear Linux OS from the menu.

  3. In the console window, log in as root and set a password.

  4. Verify you have a network connection to the Internet and configure proxy settings if you’re working behind a firewall.

  5. Download a sample YAML configuration file. For example, if you want to install Clear Linux OS with a desktop GUI, you might want to use live-desktop.yaml. Or you can use the live-server.yaml if you want to install a non-GUI version of Clear Linux OS.

    • Desktop:

      curl -O https://cdn.download.clearlinux.org/current/config/image/live-desktop.yaml
      
    • Server:

      curl -O https://cdn.download.clearlinux.org/current/config/image/live-server.yaml
      
  6. Edit the YAML configuration file and change the settings as needed.

    Commonly-changed settings include (refer to the example below):

    1. Under block-devices (line 15), set your target media. For example: file: "/dev/sda".

    2. Under targetMedia (line 34), set the third partition size to “0” to use the entire disk space.

    3. Under bundles (line 37), add additional bundles as needed.

    4. Delete the post-install section unless you have post-installation scripts.

    5. Under Version (line 50), set a version number. To use the latest version, set to “0”.

    See Installer YAML Syntax for more details.

     1          #clear-linux-config
     2
     3          # c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil
     4          # vi: set shiftwidth=2 tabstop=2 expandtab:
     5          # :indentSize=2:tabSize=2:noTabs=true:
     6
     7          # File:         developer-live-server.yaml
     8          # Use Case:     Live Image which boots into login prompt
     9          #               Optionally allows for installing Clear Linux OS
    10          #               using the TUI clr-installer by running clr-installer
    11
    12          # switch between aliases if you want to install to an actual block device
    13          # i.e /dev/sda
    14          block-devices: [
    15             {name: "bdevice", file: "/dev/sda"}
    16          ]
    17
    18          targetMedia:
    19          - name: ${bdevice}
    20            type: disk
    21            children:
    22            - name: ${bdevice}1
    23              fstype: vfat
    24              mountpoint: /boot
    25              size: "150M"
    26              type: part
    27            - name: ${bdevice}2
    28              fstype: swap
    29              size: "32M"
    30              type: part
    31            - name: ${bdevice}3
    32              fstype: ext4
    33              mountpoint: /
    34              size: "0"
    35              type: part
    36
    37          bundles: [os-core, os-core-update, NetworkManager, clr-installer, vim]
    38
    39          autoUpdate: false
    40          postArchive: false
    41          postReboot: false
    42          telemetry: false
    43          iso: true
    44          keepImage: true
    45
    46          keyboard: us
    47          language: en_US.UTF-8
    48          kernel: kernel-native
    49
    50          version: 30010
    
  7. Start the unattended installation using the –config option.

    clr-installer --config live-server.yaml
    
  8. Reboot your system after installation is completed.

Example 2: Replicate a previous installation

This example uses a saved configuration file from a previous installation, which you can use to easily clone the installation on additional machines , ideally with the same hardware configuration.

Warning

Be aware of the following when applying a saved configuration on a new machine:

  • Make sure the target media on the new machine matches up

  • The users’ credentials will be replicated as well

  1. On a system where Clear Linux OS was installed, open a terminal window.

  2. Get root privilege.

    sudo su
    
  3. Copy the clr-installer.yaml from /root to a USB thumb drive.

    cp /root/clr-installer.yaml <USB-thumb-drive>
    
  4. Install on target system.

    1. Boot up the Clear Linux OS Live Server USB thumb drive.

    2. Select Clear Linux OS from the menu.

    3. In the console window, log in as root and set a password.

    4. Verify you have a network connection to the Internet and configure proxy settings if you’re working behind a firewall.

    5. Plug in and mount the USB thumb drive containing the retrieved clr-installer.yaml configuration file.

    6. Doublecheck to make sure the target media in the saved configuration file matches with the target system’s.

    7. Start the installation.

      clr-installer --config clr-installer.yaml
      
    8. Reboot your system after installation is completed.

References