In this tutorial, we will be going through the basic steps of setting up your Raspberry Pi.
The following steps, especially the terminal commands, are to be done on a Mac or PC running Linux but the outlined process is the same on Windows.
What is meant by Headless
When I say we are going to do a headless setup, I mean that we are going to set up the Raspberry Pi without interacting with the GUI of the Raspberry Pi. This enables us to set up the device without needing an additional display, keyboard or mouse.
You will need the basic software requirements listed here.
In addition to the basic hardware requirements listed here, you will also need an ethernet cable.
For this tutorial, the Raspberry Pi will be connected to your network via ethernet. This connection can be made directly to your router or it can be made directly to a Mac – follow these steps to enable internet sharing on your Mac if you will be doing it this way.
Setting up your Raspberry Pi
Now that you’ve got everything together, lets begin.
Connect your SD card to your PC and open Raspberry Pi Imager.
Click on CHOOSE OS and select Raspberry Pi OS.
For this tutorial, we will just be installing the basic Raspberry Pi OS. You can scroll through the list of operating systems to see what else is available through Raspberry Pi Imager.
Click CHOOSE STORAGE and select your MicroSD card from the list.
Remember, the contents and data on this card are going to be erased.
A prompt will appear to warn you that your data will be erased, click yes.
A prompt may appear requesting your password. This is so that Raspberry Pi Imager has the privileges to erase and write to your MicroSD card. Enter your password and continue.
Raspberry Pi Imager will now write the files to your MicroSD card. Do not unplug your MicroSD card during this process. Once Raspberry Pi Imager is done, you will get the following screen.
Because we are setting up a headless Pi, we will need a way to interact with the Raspberry Pi. We do this using SSH.
SSH stands for Secure Shell and basically allows us to interact with the Raspberry Pi through terminal.
If Raspberry Pi Imager has automatically ejected your MicroSD card, mount it. The easiest way to do this is to unplug it and plug it back in.
Open Terminal and navigate to your SD card using cd by typing the following and then hitting enter:
We then create an ssh file by entering the following followed by enter:
You can now unplug eject and unplug your SD card.
Plug your MicroSD card into your Pi, connect your Pi to your PC or Router via ethernet and plug it into power.
You will see a red light, then a green light flashing. This is your Pi booting up.
Get the IP address of your Pi.
Open a terminal window and type the following and hit enter after
You will get a response similar to
64 bytes from raspberry.pi.ip: icmp_seq=0 ttl=64 time=0.520 ms, take note of the ip address and click control and c to stop the ping.
SSH into your pi.
In your terminal window type this followed by enter
If you get a yes/no question, type
yes and hit enter.
When prompted for a password, type
raspberry and hit enter, nothing will show while you are typing.
The root password for your Pi is set to raspberry by default
You have successfully set up your Raspberry Pi and connected to it via ssh. You can now interact with your Pi via ssh using terminal, however you can still connect the Pi to a keyboard, mouse and display and interact with it through the GUI.