Sub topic 18
Repeating the Install with Automation
This chapter assumes you can install Linux manually, edit text files, and identify the target disk and network settings. It also assumes you can test a virtual machine before using automation on a production server.
Manual installation is useful for learning, but it is slow and difficult to reproduce exactly. Automated installation supplies the installer with answers in advance. The installer can then create partitions, install packages, create users, and apply initial settings with little or no interaction.
Choose the automation method
The method depends mainly on the distribution:
- Debian and Ubuntu traditionally use preseed, a file containing answers for the Debian Installer.
- Ubuntu Server uses autoinstall, a YAML configuration interpreted by Subiquity.
- RHEL, Rocky Linux, AlmaLinux, and Fedora use Kickstart, a text file containing installation instructions.
These formats are not interchangeable. A configuration for one installer may be ignored or partially applied by another.
| Method | Common systems | Main format |
|---|---|---|
| Preseed | Debian and older Ubuntu installers | Debian Installer answers |
| Autoinstall | Modern Ubuntu Server | YAML |
| Kickstart | RHEL-family systems and Fedora | Text directives |
Understand the workflow
An automated install still follows the same broad stages as a manual install. The installer boots from an ISO or network source, reads its configuration, partitions the selected disk, installs the base system, and runs any requested post-install actions.
flowchart TD
A[Boot installation media] --> B[Load automation configuration]
B --> C[Select disk and partition]
C --> D[Install packages and users]
D --> E[Run post-install commands]
E --> F[Reboot into the new server]
F --> G[Verify hostname, network, SSH, and updates]Build and test a configuration
Start with a minimal configuration that defines only predictable choices:
- Locale, keyboard, and timezone.
- Network identity and hostname.
- The intended storage layout.
- A non-root administrative user.
- Required packages.
- A controlled first-boot or post-install script.
Keep secrets out of files committed to source control. Generate encrypted password hashes when a password is required, and prefer SSH keys for administration. Treat the configuration as code: store versions, review changes, and keep a known-good copy.
The installer may finish successfully while a post-install command fails. Review installer logs and test the resulting system, rather than treating a successful reboot as proof that every setting applied.
Common failure modes
- The configuration uses directives from a different installer version.
- YAML indentation makes an autoinstall file invalid.
- The disk identifier changes between virtual and physical machines.
- A package name differs between distributions.
- Network-dependent commands run before networking is ready.
- A script disables SSH access before key login has been tested.
- The automated file contains a plaintext password or private key.
Automation improves consistency, but it does not remove the need for verification. Run the same baseline checklist after every automated installation.
Exercise
Which first test provides the safest way to validate a new automated installation file?
Show answer
Run it against a disposable virtual machine, then verify storage, users, SSH access, networking, packages, and logs before using it on a real server.