Raspberry Pi Headless
Setting up WiFi and SSH on a Raspberry PI Headlessly
Updated: 03 September 2023
Get the OS Ready
To setup a headless Pi you need to do the following:
- Download the Raspberry Pi Imager
- Download the OS you want (You can find them here)
- Apply the downloaded image to an SD Card using the imager
Configure WiFi
With Raspberry Pi Imager
Information on using th Raspberry Pi Imager advanced options can be found on the Raspberry Pi website
Using Raspberry Pi Imager, you can click on the advanced options icon (cog) at the bottom right of the UI or type ctrl + shift + x
to open the menu. In this menu be sure to configure the following options
- Enable SSH
- WiFi SSID and Password
- Optional: Change Username and Password
- Optional: Set Hostname
Without Raspberry Pi Imager
Since you won’t be able to interact with the Pi (because it’s headless) you will want to configure the WiFi if you will be using it through that
Setup WiFi
Create a wpa_supplicant.conf
in your Pi’s root directory in your SD Card, this will be copied to the correct place when starting up. The file should have the following contents:
wpa_supplicant.conf
Enable SSH
Next, you will want to configure SSH, you just need to add an empty file named ssh
to the filesystem directory, note that when you SSH in later, the default username is pi
and the password is raspberry
You can wait a few minutes and try to reach the pi with ping rasberrypi.local
, if this responds then you can possibly just skip the IP stuff if you don’t need it to be static and you can SSH with:
If you’re not able to do so you may need to look around and try to find the IP some other way
Get the PI IP
- Get your current PC’s IP
- Run
sudo nmap -sn <YOUR IP>/24
(linux) orarp -a
(windows) to view the IP’s of devices on your network - Check if any have the hostname
raspberrypi
and check the IP. If none of them have the hostname just wing it and try a few, idk. - Next use
ssh pi@<RaspberryPi IP>
and log in with the passwordraspberry
Once you’re logged in, the device will prompt you to change the password, you can do this from the Pi’s config. To open the config menu run:
And then select the first option to Change User Password
Make the IP Static
- From your Pi, run the following command:
And edit/uncomment the Example Static IP Configuration, the only important thing to do here is to set the interface
to be wlan0
and set the ip_address
to the IP you want to use, everything else doesn’t really matter too much and can likely stay as-is
Then quit and save, now that you’ve set the IP, you can reboot your Pi with:
And then SSH using your new IP Address that you assigned above. This is to ensure that you can always find the Pi on your network easily. You will now be prompted to login - be sure to use the updated password that you configured
Add Node.js
Installing Node involves getting the installation script and running the script, you can do this by running the following command:
Then:
Finally, you can check the version with:
Add Yarn
Similar to Node, you need to install Yarn using a setup script:
And then: