Sub topic 8
Installers and out-of-the-box defaults
This chapter assumes you can use a Linux shell, know the basics of systemd services, and have read the earlier chapters on distribution families and on package management with apt and dnf. It covers what each distribution does at install time and what a fresh system looks like afterward. These defaults decide how much hardening work you do on day one.
Three installers, three automation formats
Each distribution has its own installer. Each installer has its own file format for unattended installs.
| Row | Ubuntu Server | Debian | Rocky Linux |
|---|---|---|---|
| Installer | Subiquity (text UI, live server ISO) | debian-installer (text or graphical) | Anaconda (graphical by default, text mode available) |
| Automation | Autoinstall (YAML, delivered through cloud-init) | Preseed (debconf answers) | Kickstart |
| Saved answers after install | `/var/log/installer/autoinstall-user-data` | `debconf-get-selections --installer` | `/root/anaconda-ks.cfg` |
| Package selection | Few questions: SSH server, optional snaps | `tasksel` tasks, such as "SSH server" and "standard system utilities" | Base environment: Server, Server with GUI, or Minimal Install |
| Root account | Locked, first user gets `sudo` | Root password set, or left empty to disable root and give the first user `sudo` | Root password or locked root, plus an optional admin user in `wheel` |
Subiquity is the shortest interactive installer. It asks about network, storage, a user, and whether to install OpenSSH. Anaconda shows an Installation Summary hub where you visit each section in any order, so it takes more clicks but exposes more options. The Debian installer is a linear sequence of questions, and its package selection stage is where you decide how much software lands on the disk.
All three installers can produce a reusable answer file from an interactive run. A common workflow is to install one machine by hand, collect the saved file, and edit it for the rest of the fleet.
Ubuntu autoinstall
Autoinstall is YAML under an autoinstall: key. You supply it as cloud-init user data, often on a second volume labeled cidata or over HTTP using the autoinstall ds=nocloud-net;s=http://host/ kernel arguments.
#cloud-config
autoinstall:
version: 1
locale: en_US.UTF-8
keyboard:
layout: us
identity:
hostname: web01
username: admin
password: "$6$REPLACE_WITH_OUTPUT_OF_mkpasswd"
ssh:
install-server: true
allow-pw: false
authorized-keys:
- ssh-ed25519 AAAAC3REPLACE admin@example
storage:
layout:
name: lvm
packages:
- chrony
updates: securityGenerate the password hash with mkpasswd -m sha-512 from the whois package. If you leave out a section, Subiquity asks the question interactively. That is useful while you are developing the file. For a truly unattended run, list the sections that must not prompt in interactive-sections: [], or supply every section.
Debian preseed
Preseed is a list of d-i owner key type value lines. You pass it with auto url=http://host/preseed.cfg on the boot command line, or build it into the ISO.
d-i debian-installer/locale string en_US.UTF-8
d-i keyboard-configuration/xkb-keymap select us
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string web01
d-i netcfg/get_domain string example.com
d-i mirror/country string manual
d-i mirror/http/hostname string deb.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
d-i passwd/root-login boolean false
d-i passwd/user-fullname string Admin
d-i passwd/username string admin
d-i passwd/user-password-crypted password $6$REPLACE_WITH_HASH
d-i partman-auto/method string lvm
d-i partman-auto/choose_recipe select atomic
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
tasksel tasksel/first multiselect ssh-server, standard
d-i pkgsel/include string chrony
d-i finish-install/reboot_in_progress noteWith passwd/root-login set to false, the installer leaves root locked and puts the user in the sudo group. Preseed questions are asked unless an answer exists, so a single missing key stops an "unattended" install at a prompt. Watch the console on the first test run.
Rocky Kickstart
Kickstart is a plain command file with a %packages section. You pass it with inst.ks=http://host/ks.cfg on the boot command line.
cdrom
text
lang en_US.UTF-8
keyboard us
timezone UTC --utc
network --bootproto=dhcp --hostname=web01
rootpw --lock
user --name=admin --groups=wheel --iscrypted --password=$6$REPLACE_WITH_HASH
sshkey --username=admin "ssh-ed25519 AAAAC3REPLACE admin@example"
firewall --enabled --service=ssh
selinux --enforcing
services --enabled=sshd,chronyd
clearpart --all --initlabel
autopart --type=lvm
reboot
%packages
@^minimal-environment
chrony
%endKickstart states security policy directly, with firewall and selinux lines. If you omit them, you get the distribution defaults described below. Stating them anyway documents your intent.
What a fresh system looks like
The installers differ less than the resulting systems do. Three areas matter most: accounts, networking, and background services.
Accounts and privilege
Ubuntu and Rocky both discourage direct root login, in different ways. Ubuntu locks the root password and relies on sudo for the first user. Rocky asks you to set a root password or lock it, and offers a checkbox to allow root SSH login with a password. Leave that checkbox cleared. The Debian installer asks for a root password first, and leaving it blank gives you the Ubuntu-style arrangement. Check which way a Debian host was installed before you assume sudo works:
getent group sudo wheel
sudo -l
passwd -S rootpasswd -S root prints L when the account is locked and P when a usable password is set.
Networking
Ubuntu Server configures networking with Netplan, with YAML files in /etc/netplan/ rendered to systemd-networkd. Rocky uses NetworkManager, managed with nmcli or nmtui. Rocky 9 stores connections as keyfiles under /etc/NetworkManager/system-connections/. Older ifcfg files are deprecated. A minimal Debian server typically uses ifupdown with /etc/network/interfaces, though choosing a desktop task brings in NetworkManager. The firewall and network tools chapter covers the day-to-day commands. Here the point is that the installer writes the first configuration, so a static address entered during install ends up in a different file on each system.
Firewall and mandatory access control
| Default state after install | Ubuntu Server | Debian | Rocky Linux (Server) |
|---|---|---|---|
| Firewall front end | `ufw` installed, inactive | None active; the `nftables` package is present but no rules are loaded | `firewalld` active, SSH allowed |
| Mandatory access control | AppArmor enforcing for confined profiles | AppArmor enabled with few profiles | SELinux enforcing, targeted policy |
| Automatic security updates | `unattended-upgrades` enabled | Not enabled by default in a typical install | Not enabled; `dnf-automatic` is optional |
| SSH daemon | Installed only if you ticked it | Installed only if you chose the `ssh-server` task | Running in the Server environment |
The consequence is that a new Ubuntu or Debian host is open on every port a service listens on, while a new Rocky host blocks everything except what firewalld allows. Neither is wrong. They differ in how much you must remember. On Ubuntu and Debian, enable a firewall as part of your build. On Rocky, open each port you need, and expect to adjust SELinux labels or booleans when you move data directories or use non-standard ports.
Service naming and package set
The SSH service is ssh on Debian and Ubuntu and sshd on Rocky. Ubuntu 24.04 also starts SSH through socket activation (ssh.socket), so changing the listening port means editing the socket unit or disabling socket activation, not just editing sshd_config. Check before you assume:
systemctl status ssh.socket ssh 2>/dev/null || systemctl status sshdUbuntu Server ships with snapd and cloud-init preinstalled. Rocky's Server environment includes more utilities than Minimal Install, but both include chrony for time synchronization on current releases. Debian's installed set depends on the tasks you select. A "standard system utilities" install is fairly small, and without it you get a bare base.
Auditing a fresh install
Before you build on an image, look at what the installer left. This script prints the facts that differ most between the three systems. It works on any of them, and it skips checks for tools that are not installed.
#!/usr/bin/env bash
set -u
. /etc/os-release
echo "== $PRETTY_NAME (ID=$ID, ID_LIKE=${ID_LIKE:-none}) =="
echo "-- Listening TCP sockets"
ss -tln
echo "-- Mandatory access control"
if command -v getenforce >/dev/null 2>&1; then
echo "SELinux: $(getenforce)"
fi
if command -v aa-status >/dev/null 2>&1; then
sudo aa-status --enabled && echo "AppArmor: enabled"
fi
echo "-- Firewall"
if command -v firewall-cmd >/dev/null 2>&1; then
sudo firewall-cmd --state
sudo firewall-cmd --list-services
elif command -v ufw >/dev/null 2>&1; then
sudo ufw status
else
echo "No ufw or firewalld; check: sudo nft list ruleset"
fi
echo "-- Automatic updates"
systemctl is-enabled unattended-upgrades dnf-automatic.timer 2>/dev/null \
|| echo "No automatic update service enabled"Run it once on each candidate and keep the output next to your requirements. Differences you did not expect are the ones that cause surprises in production.
Practical consequences
- Minimal versus full installs. A smaller package set means a smaller attack surface and fewer updates. It also means missing tools like
tcpdumporlsofduring an incident. Decide deliberately and bake the extra tools into your automation. - Cloud images skip the installer entirely. Ubuntu, Debian, and Rocky each publish cloud images that boot with cloud-init and have no interactive install. The defaults above still apply, but your configuration arrives as user data. The cloud chapter covers this.
- Reproducibility beats choice. Your automation file, not the interactive menu, is the real definition of "how we install servers." Keep it in version control.
- Hardening lists differ. Ubuntu and Debian builds need a firewall step. Rocky builds need a check that you have not set SELinux to permissive "temporarily" and never switched it back.
Exercise
You install Debian from the standard installer and leave the root password blank. After logging in as your new user, which group gives you sudo, and what does passwd -S root report?
Show answer
The installer adds your user to the sudo group. passwd -S root reports L, meaning the root account is locked. If you had set a root password, the user would not be in sudo and passwd -S root would report P.
Exercise
A new Rocky Linux Server host and a new Ubuntu Server host both run a web service on TCP port 8080. From another machine, which one is reachable by default, and why?
Show answer
The Ubuntu host is reachable. ufw is installed but inactive, so nothing blocks port 8080. On Rocky, firewalld is active and allows only SSH, so port 8080 is blocked until you run sudo firewall-cmd --permanent --add-port=8080/tcp followed by sudo firewall-cmd --reload. SELinux may also need a policy change if 8080 is not already a permitted port for your service.
Exercise
Name the automation file format for each installer: Subiquity on Ubuntu Server, debian-installer, and Anaconda on Rocky Linux. Where do you find a record of the choices made in an interactive Rocky install?
Show answer
Subiquity uses autoinstall (YAML delivered through cloud-init), debian-installer uses preseed, and Anaconda uses Kickstart. The Rocky record is /root/anaconda-ks.cfg.