Using Raspberry Pi in headless mode

It is possible to use a Raspberry Pi in headless mode. So without a keyboard and monitor.

First install an OS on the Raspberry Pi. Download the latest imager and install it on your desktop. Run the imager and write the Raspberry Pi OS on the SD-card. When you remove and insert the card you will see that it has a boot partition.

Create an empty file with the name “ssh” in the root of the boot partition of the SD-card. This will enable the SSH daemon so that you can connect with SSH to the server.

If you have WIFI on board you can also enable this on startup. Create a file called wpa_supplicant.conf in the same boot partition. Example content:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
country=<Insert 2 letter ISO 3166-1 country code here>
update_config=1

network={
 ssid="<Name of your wireless LAN>"
 psk="<Password for your wireless LAN>"
}

The additional files in the boot partition will be moved to the correct location on the Linux operating system after the OS has been started.

Now connect power to your Raspberry Pi and wait a few minutes for the OS to boot. Connect to it with an SSH terminal e.g. Putty on your desktop. However first you will have to find out what the IP-address is. I found the IP-address on an admin page of my Wireless router.

References:
https://www.raspberrypi.org/documentation/computers/
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html