wolfgang ziegler


„make stuff and blog about it“

Raspberry Pi: Headless Setup

April 21, 2021

Note: I'm aware that there are plenty of tutorials on "headless setup of a Raspberry Pi" out there already, but not all of those worked out for me. Hence, as so often, I'm writing this more for my future self than for you. That way, I can look up this blog post later and find a how-to of which I know that it has once worked for me.

Prepare WIFI Connection

Mount the microSD card on your PC and put a file called wpa_supplicant.conf in the /boot folder of its file system. In this file you can prepare the WIFI configuration of your Raspberry Pi.

country=AT
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
	scan_ssid=1
	ssid="your_wifi_ssid"
	psk="your_wifi_password"
}

Enable SSH

Create an empty file named sshin /boot.

Test

Try and ping your Raspberry Pi. It should be available under the default host name raspberrypi. If this does not work, check your router and find out its IP.

$ ping raspberrypi
PING raspberrypi.localdomain (192.168.1.102) 56(84) bytes of data.
64 bytes from raspberrypi.localdomain (192.168.1.102): icmp_seq=1 ttl=64 time=1.18 ms
...

SSH should work as well using the default user pi with the password raspberry (change this!).

$ ssh [email protected]
...

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

Configure

Now you can run sudo raspi-config to configure your Raspberry Pi.

Done

GIF: Boom. Easy as that.