Install a Minimal Headless Debian Server

This guide outlines the complete process for deploying a lightweight, headless Debian server without a graphical user interface. You will learn how to obtain the minimal installation media, navigate the essential installation prompts, exclude unnecessary desktop packages, and configure remote SSH access so the machine can operate independently without a monitor, keyboard, or mouse.

1. Download the Minimal Media

Download the Debian "Netinst" (Network Installer) ISO from the official Debian website. This minimal image contains only the core installer; all required packages will be downloaded during setup, ensuring a clean and up-to-date base system. Flash the ISO to a USB drive using a tool such as Rufus, BalenaEtcher, or the dd command.

2. Boot the Installer

  1. Insert the installation media into the target machine and boot from it via the BIOS/UEFI boot menu.
  2. Select Install (text mode) or Graphical Install. The standard text-based installer uses fewer resources and works identically for a server setup.

3. Configure Localization and Network

  1. Select your preferred Language, Country, and Keyboard layout.
  2. Enter a Hostname (the name identifying the server on your local network, e.g., debian-server).
  3. Enter a Domain name (leave blank if you do not use a local domain).

4. Set Up User Accounts

  1. Root Password: Enter and confirm a strong password for the root administrative user. (If left blank, Debian disables the root account and grants full administrative privileges to the primary user via sudo.)
  2. User Account: Enter the real name, username, and password for a standard non-root user.

5. Partition the Storage Drive

  1. Select Guided - use entire disk for a standard server setup. (Alternatively, select LVM if you plan to resize partitions later.)
  2. Choose the target hard drive or SSD.
  3. Select All files in one partition (recommended for new users) or separate partitions for /var, /tmp, and /home depending on your requirements.
  4. Select Finish partitioning and write changes to disk, then confirm with Yes.

6. Configure the Package Manager

  1. Select a mirror country close to your physical location.
  2. Choose an official Debian archive mirror (e.g., deb.debian.org).
  3. Leave the HTTP proxy field blank unless your network requires a proxy to access the internet.
  4. Choose whether to participate in the package usage survey (Popularity Contest).

7. Software Selection (Crucial Step for Headless)

When the Software selection screen appears:

  1. Uncheck "Debian desktop environment" and any specific desktop environments (GNOME, XFCE, etc.).
  2. Check "SSH server" to enable remote command-line access.
  3. Check "standard system utilities" for basic terminal tools.
  4. Press Continue to install only the base packages.

8. Install the GRUB Bootloader

  1. When prompted to install the GRUB bootloader to the primary drive, select Yes.
  2. Choose the drive where Debian was installed (e.g., /dev/sda or /dev/nvme0n1).

9. First Boot and Headless Configuration

  1. Finish the installation, remove the USB drive, and allow the server to reboot.

  2. Log in at the local terminal with the user account created during setup.

  3. Identify the server's IP address:

    ip a
  4. Verify the SSH service is active:

    sudo systemctl status ssh
  5. Log out, disconnect the monitor and keyboard, and connect to the server remotely from your local computer:

    ssh username@server_ip_address