nerdstuff.org

crazy content for mankind, great stuff for nerds

16 Feb 2020

Automating the Installation of Arch Linux Systems

Arch Linux is great because it brings flexibility and gives users control since it’s their decision how the system is set up and configured. On the other hand, the standard installing process is completely manual, and if the installation needs to be done more often or if multiple machines need to be installed, the process can become cumbersome and annoying. In this post, we will discuss some approaches to make the installation more convenient and easier to repeat.

The installation of an Arch Linux system can be divided into three steps:

  1. Installation of the Arch Linux base system
  2. Installation of additional software packages and its global (i.e. user-independent) configuration
  3. Personal (i.e. user-specific) configuration

Let’s take a closer look at each of these steps:

1. Installation of the Arch Linux Base System

This step typically comprises the activities that are mentioned in the Arch Linux installation guide, such as in the partitioning of disks, formatting and mounting of partitions, configuration of fstab, time zone, localization etc.

There are different possibilities to make this more convenient:

Arch-based Distribution with Live Mode

Instead of booting the system to be installed from the Arch Linux ISO into a root console, an Arch-based distribution with a live mode could be used - not all distributions offer this possibility.

To install Arch Linux, you boot the machine into the live mode of the distribution, open a browser window with the installation instruction of Arch Linux and - in parallel - a terminal window where you actually do the installation. With this approach, you have the installation instruction and the terminal side by side and can copy and paste commands. That’s quite convenient and keeps the full control in your hands.

Installation Scripts

There are various scripts out there, that provide a guided, menue-based installation process. Some examples:

To install Arch Linux with such a script, the machine is normally booted from the Arch Linux ISO. The installation script is then downloaded via curl or wget.

While the installation is easier than with the already mention approach, the flexibility is often limited. Most of these installers have restrictions, sometimes they to not support encryption or a partition schema with LVM, sometimes they do not support the boot manager / boot loader that you want etc. Thus, using such installer is a trade-off between convenience and flexibility.

2. Installation of Additional Software Packages

This step is about installing additional software packages to the base system, such as a (graphical) desktop environment (DE) and other applications one typically needs (a web browser, a mail client, maybe an IDE, and so on and so forth). Maybe you want to use one of the bundled DE’s, such as Gnome, KDE/Plasma or Xfce, or maybe you want to bundle your own custom DE. In addition to the pure installation of the software, configuration and theming is required, but also the enablement of (systemd) services.

Meta packages can take care of all this. They are Arch Linux packages that depend on other packages. The installation of a meta packages triggers the installation of all packages that the meta package depends on. Thus, a meta package can be used to install a specific set of Arch Linux packages. Furthermore they can contain logic to create or modify configuration files or to enable services. To make a meta package available for installation, a custom repository is a good means. More details about meta packages will be covered in a dedicated post. So far, [2] might help.

3. Personal Configuration

The user-specific configuration is typically done via dotfiles. They can be managed and transferred between systems with dotfile managers.

Summing It Up

With the presented approaches, the overall installation process would be as follows:

Preparation

  1. Prepare the meta package(s) and make them available via a custom repository.
  2. Download the ISO that you want to use for the installation - either the Arch Linux ISO or an Arch-based distribution with live mode.

Installation

  1. Boot your machine from the ISO media.
  2. Install the base system either via the standard installation guide or via a 3rd-party installation script.
  3. Reboot your machine. Add your custom repository to /etc/pacman.conf and install the meta package via pacman -Syu <your-meta-package>
  4. Reboot your machine. Create a user (provided, this hasn’t been done before), and create the user-specific configuration with a dotfile manager
  5. Have fun with your new system

References

[1] Arch Linux Installation Guide

[2] Managing Arch Linux with Meta Packages

comments powered by Disqus