This guide has been updated!
Check out the updated version here!
Not all Raspberry Pi projects need a monitor, keyboard, and mouse you may just need a Headless Raspberry Pi. Sometimes you just need a simple machine you can SSH into and test out some new python code, or set up a small web server, the possibilities are endless. If you are trying to set up the desktop version of Raspbian head over to My Raspberry Pi Setup Guide for information on how to do that.
The first thing we are going to need to do is to download Raspbian Lite to do that lets head over to the official source. At the time of writing this the current release is named Buster, you can find it at the official raspberry pi website. I would not recommend downloading it from anywhere but there you never know what evil people may try to put inside the images. We are going to be downloading “Raspberry Pi OS (32-bit) Lite Minimal image based on Debian Buster”. After downloading the image we are going to need something to write it to the SD card so we can put it on the Raspberry Pi and start our headless setup.
There are lots of options for tools that can write images to SD cards my personal favorite is Win32 Disk Imager I have been using it for several years with no issues. Simply select the image file, device, and click the write button. It will take a couple of minutes and we will be onto the next step! Make sure you do not eject the SD card from your computer yet as we still need to make two files (or 1 if your using ethernet instead of WiFi).
Open notepad (regular plain old notepad works best if on windows) the first file we are going to need to set up our headless raspberry pi is “SSH”, no extension no contents just an empty file. Let’s say for sake of example my SD card is mounted on the E drive. Save the file “SSH” at the location (replacing E with your drive) E:\boot\SSH when your Pi boots up this will automatically enable the SSH service so we can connect to our device.
There is one more file to make if we want our Pi to connect to WiFi in the same folder we are going to make a file named “wpa_supplicant.conf” this file is not going to be blank though. The contents of the file will be as follows:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid="Your WiFi Name"
psk="Your WiFi Password"
}
If you are not in the United States you will need to change US to your 2 digit country code or else your WiFi may not work correctly. Eject the SD card insert it into your Pi and presto, a headless raspberry pi just add power (and Ethernet if you didn’t use WiFi).