How To Install Debian

How To Install Debian

Reading time1 min
#Linux#OpenSource#OperatingSystem#Debian#Installation#SysAdmin

Mastering Debian Installation: A Step-by-Step Guide for Precision and Performance

Installing Debian often gets trivialized—download, click Next, reboot. For reliable infrastructure, this is a mistake. Out-of-the-box defaults are rarely aligned with production workloads, security models, or future maintenance. Deploying a system you trust means scrutinizing every installation stage.

Below: a field-tested process applying to Debian 12 ("Bookworm") as of 2024, with scenarios for both servers and workstations. Expect technical specificity, ops caveats, and notes from real deployments.


The Impact of Your Install Choices

Filesystem selection influences restore times and I/O patterns. User provisioning and encryption policies set the baseline for security audits. Subtle installer questions on locales or networking, if ignored, complicate CI/CD pipelines or cross-regional deployments months later. Installation isn't a formality; it's the foundation for a functional, secure environment.


1. Preparing Installation Media

Download: Fetch the official netinst ISO from https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/. For headless systems or minimal profiles, prefer debian-12.x.x-amd64-netinst.iso (approx. 400MB).

Checksum: Always verify ISO integrity. For example, after download:

sha256sum debian-12.5.0-amd64-netinst.iso
# Compare result to SHA256SUMS from Debian mirrors

Skipping this risks corrupt or tampered images.

Write Image:

  • Linux/macOS:
    sudo dd if=debian-12.5.0-amd64-netinst.iso of=/dev/sdX bs=4M status=progress conv=fsync
    
  • Windows: Use Rufus.

Side note: dd makes destructive writes. Double-check the target disk. Energetic sysadmins have wiped their root disks by typo.


2. Installer Entry Points: Picking the Right Mode

Debian's installer supports:

  • Graphical mode (suitable for desktops; less for serial-over-LAN workflows)
  • Text mode (Install in the boot menu) for automation and headless servers
  • Expert install: exposes granular options, e.g., manual kernel module selection, preseeding

Scripted installs (via preseed.cfg) can fully automate thousands of hosts, useful in datacenter fleet operations, PXE boots, or cloud VM summersaults.

Tip: Even for single servers—Expert install reveals useful features (e.g., custom mirror, network driver injection).


3. Locale, Language, and Keyboard Config

Locale drift is a common root cause of broken logs, systemd unit issues, or misformatted timestamps on multinational fleets.

  • Choose locale with intent: US English, UTF-8, unless regional requirements dictate otherwise.
  • Keyboard/layout: Confirm physically if remote hands are involved. A mismatch can brick console connections in emergencies.

4. Networking and Host Identity

The installer attempts DHCP first. For production, always consider a static configuration:

Manual Network Example:

IP Address: 192.168.20.41
Netmask: 255.255.255.0
Gateway: 192.168.20.1
DNS Servers: 8.8.8.8 
Hostname: app01-staging
Domain: staging.internal
  • Hostnames should map predictably inside configuration management and monitoring (think: host_vars/app01-staging.yml in Ansible).
  • For multi-NIC servers, ensure only management interfaces get hostnames; leave BMCs and VLANs to out-of-band.

5. User/Root Account Policy

Old-school: set root password, login as root. Current best practice: leave root password blank (the installer disables root login), create a primary user with sudo privileges.

Example:

Root password: [leave blank]
Full name:      Maya Patel
Username:       mpatel
Password:       [strong, min 16 chars]

Note: Direct root login via SSH is disabled by default on modern images, but always audit /etc/ssh/sshd_config post-install.

  • PermitRootLogin no
  • PasswordAuthentication no if using keys

6. Disk Partitioning: Filesystems and Layout

The debate: LVM, standard partitions, or ZFS? Each has trade-offs.

Guided Partitioning: Acceptable only for non-critical desktops. Avoid on servers—defaults may ignore alignment to SSD boundaries, redundant boot partitions, or space for snapshots.

Manual Partition Example (SSD-backed VM):

Mount PointSizeFS TypeNotes
/boot1 GBext4Required for separate /boot with LUKS
/20 GBext4Minimal OS, easier to snapshot
/var10 GBext4Logs, database files
/homerestext4Separated user data
swap4 GBswapAdjust: hibernate or container host

Encryption: Use LUKS/dm-crypt. With LVM-on-LUKS, separating /boot unencrypted is required.

  • Strong passphrase: Avoid single dictionary words; consider FIDO2 or TPM2 integration in risk-sensitive workloads.

Filesystem: For most, ext4 is reliable. Btrfs or ZFS: only deploy if compression, snapshots, or self-healing matter—there are non-obvious kernel and initramfs caveats (e.g., missing modules cause unbootable states). Test restore process.


7. Package Selection: Only What's Needed

Installer offers:

  • Debian desktop environment (select minimal GUI if at all)
  • SSH server (always for remote systems)
  • web/print servers (skip unless core use-case)

Keep the install surface minimal. Example: For Kubernetes nodes, only basic system utilities and openssh-server—skip GUI, web, or print servers entirely.

Post-install, install only with apt:

sudo apt update
sudo apt install zsh htop nvme-cli

Gotcha: The "standard system utilities" group sometimes pulls in legacy tools you don’t want (e.g., mailx). Review installed packages after first boot.


8. Bootloader: GRUB Details and Dual-Boot Gotchas

GRUB 2 configures itself for both BIOS and UEFI systems by default.

  • Dual-boot with Windows on UEFI: Always point GRUB to the correct EFI partition (/boot/efi).
  • Custom disk layouts: Explicitly select target for the bootloader in the installer. Blindly proceeding can overwrite boot sectors or leave systems unbootable.

Known issue: Some laptop firmwares override custom NVRAM boot order on update. Keep a live USB handy for recovery.


9. First Boot: Immediate Hardening and Validation

  1. Update all packages (security fixes):

    sudo apt update && sudo apt upgrade -y
    
  2. Check for missing drivers:

    dmesg | grep -i error
    lspci -nnk | grep -A2 Network
    
    • On Dell servers, check idracadm or vendor-specific logs.
  3. SSH hardening:
    Edit /etc/ssh/sshd_config:

    PermitRootLogin no
    PasswordAuthentication no
    # AllowUsers mpatel ops_team
    

    Restart SSH: sudo systemctl restart sshd

  4. Tooling:

    apt install atop fail2ban net-tools
    
  5. Monitoring and backups:

    • Push up your node_exporter, log aggregation agents, and offsite snapshot hooks now rather than later.

Pro Tips

  • Automated installs: Use preseeding for consistent infrastructure deployment. Example snippet (preseed.cfg):

    d-i passwd/user-fullname string CI Runner
    d-i passwd/username string ci
    d-i passwd/user-password-crypted password $6$randomsalt$...
    
  • PXE/netboot: For rackmounts, netboot is preferred—less wear on physical media, faster rollout.

  • Custom hooks: Post-install scripts placed in /target/root during install can preseed SSH keys, OS hardening steps, or monitoring agent bootstrap.

  • Rollback plan: Always ensure you can boot from rescue media and decrypt storage before tweaking bootloader or encryption.


On Perfection and Practicality

Real deployments rarely follow the “ideal” path. Sometimes you inherit disks, or need to hack around vendor firmware bugs. Sometimes a missing kernel module will block an entire fleet—keep written install logs, version notes, and a tested fast recovery plan. Ongoing maintenance, not just the first install, makes a system robust.


Summary: Precision in Debian installation delivers not just a bootable OS, but infrastructure that stands up to audit, upgrade, migration, and recovery. Each installer prompt is an opportunity for control, documentation, and long-term stability. Overlook them, and you’re debugging midnight outages six months later.


References: