Custom Installation

OpenBSD offers various options to customize the installation process:

  • Add specific, non-OpenBSD files to modify the default installation.
  • Execute commands during or after the installation process.
  • Perform unattended installations using an answer file.

The siteXX.tgz File Set #

User-created files can be added to the installation using a set called siteXX.tgz. This set is a tar archive rooted in / and will be unpacked with the -xzphf tar options. As it is installed last, it can overwrite or modify default installation files and add new ones. For host-specific customization, name the set siteXX-$(hostname -s).tgz, where hostname -s provides the short hostname.

Tools to create these sets include:

The install.site and upgrade.site Scripts #

Commands can be executed at install or upgrade time by placing an executable named /install.site or /upgrade.site respectively. The /install.site file should be included in the siteXX.gz, while the /upgrade.site file can be placed in the root directory before rebooting for an upgrade.

These scripts can be useful for:

  • Adding the system to a load balancer pool.
  • Notifying an admin of a successful installation.
  • Running arbitrary commands.
  • Running one-time commands via rc.firsttime.
  • Performing self-checks.

Unattended Installation #

OpenBSD supports unattended installations by providing answers to installer questions in a file. The system, named autoinstall, uses this answer file for installations and upgrades.

The installer looks for the answer file after the (A)utoinstall option is chosen post-boot or when a netboot is performed without user action for a set time. DHCP provides the information on where to find the answer file. The server hosting the file can be specified using:

  • server-name
  • option tftp-server-name
  • next-server

The filename can be specified with:

  • filename
  • option bootfile-name

The hostname during installation can be specified with:

  • option host-name

Example install.conf File #

System hostname = foo
Password for root = $2b$14$Z4xRMg8vDpgYH...GVot3ySoj8yby
Change the default console to com0 = yes
Which speed should com0 use = 19200
Setup a user = bar
Password for user = *************
Public ssh key for user = ssh-rsa AAAAC3NzaC1...uer37Adr foo@bar
What timezone are you in = Europe/Amsterdam
Location of sets = http
HTTP Server = cdn.openbsd.org