How to Setup a Headless Raspberry Pi – Hacker Noon
How to Setup a Headless Raspberry Pi
Operate Raspberry Pi Wirelessly through your Linux System.
Want to operate your Raspberry Pi without buying extra keyboard, mouse, monitor, etc ? Then this guide is for you.
Below methods are successfully tested on Raspberry Pi 3B and Raspberry Pi Zero W, using Arch Linux as Host OS. Moreover, this tutorial can be used for Microsoft Windows too as Windows supports Linux terminal. Use the terminal and follow steps.
If you find this blog helpful, please click the 👏 button and share to help others find it!
So, Let’s Start
Step 1 : Fulfill Requirements
You will need following resources:
- Raspberry Pi and its power adapter
- Micro SD Card (8 GB or more)
- Wireless Router (You can even use the Hot-Spot of your smartphone)
- A Linux System.
- Active Internet.
Step 2 : Download Raspbian
To go to official download page, click here.
Download “Raspbian Stretch with desktop and recommended software”. This ISO contains ssh server, vnc server and other required tools.
Step 3 : Burn the ISO to Micro SD Card
First of all, connect the Micro SD Card to your Linux System.
Use Balena Etcher to burn the Raspbian to SD Card. Etcher is an open source, very handy and easy to use, tool for burning Linux Images. (Raspbian is also Linux based). Download it from here.
Select the path to Raspbian ISO, then select your SD Card to be burned and click Flash!. It will ask for authentication.
Enter your Password. It will take some time, till then have your coffee break. :).
Step 4 : Enable SSH
boot partition of your SD Card in your File Explorer. Now run the terminal in same working directory and create an empty file with name
SSH . This has to be done only for the first-time-boot, this will enable SSH sever on your Pi, hence it can be controlled via network.
Run the following command:
$ touch SSH
Step 5 : Feed Wifi password in your Pi
The WiFi connection can be provided either by a wireless-router or a Smartphone-HotSpot.
This is necessary as we are setting up a headless Pi, we need it to connect to a network as soon as it boots. Connect it to the same network with which your Linux System is connected. This will create a local area network.
Again it has to be done only for the first-time-boot.
rootfs partition of your SD Card in your File Explorer. Now run the terminal in same working directory.
Now move to the
etc/wpa_supplicant directory and edit
Now modify it with the following content.
country=IN is for your country. Here in my code,
IN stands for India.
wpa_supplicant.conf file will look like this.
Step 6 : Find IP of your Raspberry Pi and access it using SSH.
(Note: We can skip this troublesome if we use static IP. But it will make this tutorial very tricky.)
If your router supports MDNS, (All smartphones with Andoird < 9 support MDNS through their HotSpot), simply login into your pi using command
ssh [email protected] or
ssh [email protected] . It asks for password, which by default is
We are going to operate Pi with our Host Linux System. And to establish a communication between two systems we need IP addresses. This is why we connected our System and Pi to the same router/smartphone-hotspot, so as to create a local network.
We are using router/smartphone-hotspot just as a 3rd party device to provide our system and Raspberry Pi with their IP addresses.
So let’s find the IP address of our Pi. To do this first we need to find IP address of our system. You can run any of the following command:
ip address show
As you can see , from the line
inet 192.168.1.7/24 , its obvious that my IP address is
And as my Linux system and Raspberry Pi are connected to same network, my Raspberry Pi is going to have an IP address of form
xx is any whole number between 1 to 255.
nmap . Install it on your system.
As my IP is
192.168.1.7 , I will run the following command (modify the command according to your IP):
$ nmap -sn 192.168.1.0/24
Now all the IP addresses you can see in the screenshot of my terminal, are of the devices connected to my Wifi Router.
Check which one is of your Pi.
Run the command with the IP addresses you got:
$ ssh [email protected]<ip-address>
192.168.1.8 is the IP address of my Pi.
The default password for your Raspberry Pi is