How to setup a headless Raspberry Pi
In this post we’ll go through the step-by-step process of setting up a headless Raspberry Pi. The best part is, you can do all of this from a secondary computer, so you have no need for a monitor or keyboard and mouse!
1. Purchase a Raspberry Pi, power supply, and micro SD card.
This probably seems pretty obvious, but make sure you get a micro SD card, with a minimum of 16gb of storage. Don’t forget the power supply like I did, because those can be hard to find later on.
You can get all of these things on Amazon, or get them in all together in a kit (also from Amazon).
2. Download a Raspian system image from raspberrypi.org.
You don’t have to use Raspian, but I like to stick with this – especially as I’m getting started.
3. Use etcher to copy the system image to your SD card.
Etcher makes it super easy to copy the system image to your SD card.
4. Create an empty ssh file in the root directory
While still on your computer (not the raspberry pi), cd into the root directory of the SD card and use: touch ssh
. This will generate an ssh file, which will allow you to ssh into your raspberry pi.
5. Generate a wpa_supplicant.conf
file
While still in the root directory, create a wpa_supplicant.conf file with: touch wpa_supplicant.conf
. Then use: nano wpa_supplicant.conf
. While in this file, create a network object like so:
network={
ssid="testing"
psk="testingPassword"
}
where ssid
is the name of your network, and psk
is your password.
** Extra credit: use a passphrase to encrypt your password. **
6. Insert the SD card into the pi and plug it in.
You’re ready to go!
You’re now ready to ssh into your raspberry pi from another computer and use your pi via the command line. No monitor, keyboard or mouse required!
** Extra credit: Change the hostname of Raspberry Pi **
** Extra credit: Set up a shortcut to easily ssh into your pi. **