How to setup your Raspberry Pi, Headless!

Bought your Pi, but no Monitor, mouse or Keyboard. Make it Headless!


Things used in this project


Hardware components

Raspberry Pi (Any Model)
USB Cable, USB Type C Plug
Flash Memory Card, MicroSDHC Card



Raspberry Pi Imager







Setting up your Raspberry Pi (RPi) can be excruciating. I know because I also experienced it. This method can save you a lot of money and make it easier to work on you RPi on the go. There are many articles in the internet about this. But this is the one that has it 'All in one place'.

READ: Read all the Information before starting to do this practically.


1. Installing Raspberry Pi OS to SD card.


Go to the RPi official webpage by the link below:


Scroll down till you find the 'Download' button below.


Click the 'Download' button for your Computer's Operating System.


Install the RPi imager on your Computer.


2. Write the OS into your SD Card.


Connect your microSD card to your computer. (You might need to use a SD Card Adapter).


Open RPi installer, and Click 'Choose OS'.:


Click on 'Raspberry Pi OS (32-bit)'/The one on the top.


Click 'Choose Storage' and select your SD Card reader.


In case a pop up saying that all data will be erased opens up, accept it, after saving necessary files.


Click 'Write', Then wait it writes and verifies the OS.

3. Preparations


'Eject' the MicroSD card and take it out of you computer, Immediately followed by inserting it to the computer again.


Make a file called 'wpa_supplicant.conf', in your computer.


Copy and Paste the Following code in the file.

ctrl_interface=DIR+/var/run/wpa_supplicant GROUP=netdev
country=<Your country code eg:-US/GB>
	ssid="Your Network Name (SSID)"
	psk="Your network password"

Make a empty file named "ssh" without the quotation marks, and without a file extension in Notepad. For this, you should type as "ssh" (with quotations) in the 'File Name:' and 'All Files (*.*)' in 'Save as type' sections.


This will save the file extension-less and quotation-less.




4. Connect RPi to the Internet.


Copy and Paste the two files, 'wpa_supplicant.conf' and ssh into the boot folder in your microSD card.

You will see that some files are already in the boot (The Operating System).

After the 2 files are in the boot, take out the SD card.

Still, do NOT insert it into the RPi.



5. Install NMap on your computer.


Go to the following link, download and install Nmap on your computer:



6. Install VNC Viewer on your computer.


Go to the following link, download and install VNC Viewer on your computer:

Make sure you install 'VNC Viewer', and NOT 'VNC Server'



7. Insert your microSD card into your RPi


Go ahead and get your microSD card from your SD card Adapter, and plug it into your RPi.


Then plug in your RPi into it's power source.




8. Find your RPi's IP Address.


Open your computer's terminal window.


I use 'Command Prompt', but you can use terminals such as 'Windows Powershell'.


Open Settings and go to:


Setting > Network and Internet > Wi-Fi > Properties > IPv4


In IPv4, you will find the IP address of your Computer.


It will look like: (X's are numbers in reality)


In your terminal, type:

nmap -sn

Use '0/24' instead of the last number after the last period (decimal point) of your IP, This will run through all the IP Addresses in your router, to find the RPi.


Hit Enter.


You will find your RPi's IP address, if you didn't find it, repeat it after a minute till you find the IP, listed next to an item, 'raspberrypi'.


Note down the IP of your RPi, in this case, it's highlighted, (The X's are still numbers)


9. Get into you Pi


After that use your terminal to get into your RPi's terminal.

Type on your terminal:

ssh pi@'IP'

Use the RPi's IP that you got, instead of 'IP' ( is the number that I got, your number can be different.) .


Then you will find a prompt asking for your password.


The default password is raspberry (You will not see it being typed for security reasons)


Type it in, hit Enter and:




10. View desktop of RPi (Finally!)


Launch VNC Viewer on your computer, type your RPi's IP:


Press Enter.


Type in your username : pi


If you have not changed your RPi password yet, your Password is: raspberry


You should now see your Desktop:


If I Don't see your desktop?


It is completely normal if you had an error message now, I got it too!


You might be thinking 'I did all of this for an error!'. But fixing it is relatively simple.


Option 1 (Recommended)


Get onto the RPi terminal using step 9, Then type:

sudo raspi-config

Go to 'Display options' and hit Enter:


转到“ VNC 分辨率”,然后选择并确认“ 1280x720”(我不知道为什么,但该分辨率似乎适用于所有人):


Go to 'Finish', enter it and it will ask you to reboot. Press Enter, when the pink selector is on 'Yes'.


Now the connection will be interrupted because of the reboot.


Now, try to do step 11.


Step 2 (If step 1 didn't work)


If it didn't work, it's completely normal. I didn't get the desktop too.


Redo step 9, to go to the RPi terminal, if it doesn't work, repeat after a minute.


On the RPi terminal, type:

sudo apt-get install lxsession

After LXSession is installed, type:

sudo reboot

to reboot your RPi.


Now, try to do step 11.


It should work by now and a 'Startup wizard' will appear.




You finally opened the door to your Raspberry Pi, and it's many wonders.


If you got stuck after any step, please leave a comment.


Thank You for staying till the end.

The article was first published in hackster, November 27, 2021


author: danushi13, 45132594

All Rights