Raspi – Setting up Raspberry Pi OS in headless mode

An operating system in headless mode works without a screen, keyboard and mouse, i.e. access is only possible using SSH or similar tools. Headless mode helps save resources. I personally use the headless mode especially with smaller Raspberry Pi models, like Raspberry Pi Zero 2 W.

Note: In headless mode, remote access with VNC is also not possible.

Installation

Download and install the Raspberry Pi Image tool on your PC.

Insert an SD card (with a size of 8 GB or more) into the card reader of your PC. Run Raspberry Pi Imager:

  • Click the button below Operating System
    • Select Raspberry Pi OS (other)
    • Select Raspberry Pi OS Lite (32-bit) or Raspberry Pi OS (64-bit) depending on your needs and hardware.
  • Click the button below Storage and select your SD card
  • Click the Settings button (gear) to open the advanced options dialog
    • Select checkbox Set hostname and enter the hostname for your Raspberry Pi
    • Select Enable SSH
      and select Use password authentication
    • Select Set username and password
      and enter your username and password (will be used for SSH login)
    • If you want to use WLAN select Configure wireless LAN
      and enter SSID and password of your WLAN
      and select the Wireless WLAN country (your county)
    • Select Set local settings
      and select your time zone and keyboard layout (I think the latter is not used in headless mode)
    • Finally klick Save
  • Click the Write button

After the SD card has been written, it can be removed from the PC and inserted into the Raspberry Pi.

Connect Raspberry Pi to the power supply and give it some time (a few minutes) to complete the OS installation until the LED stops flashing.

Try to login using SSH on your PC, if it doesn’t connect, give the Raspberry Pi some more time to complete the installation and try again.

ssh your-username@your-hostname.local

From here on you can follow the instructions in the articles Raspi – Setting up Raspberry Pi OS und Raspi – Setting up remote access with SSH.

Important: Shutdown the Raspberry Pi before you switch it off (before you remove the power supply) with the following command:

ssh shutdown -h now

… and wait as long as the LED flashes (a few seconds).

(Some information for this article was taken from here: https://www.digikey.ch/en/maker/blogs/2021/getting-started-with-the-raspberry-pi-zero-2-w)