Starting from just $35, Raspberry Pi is one of the cheapest computers that one can own, and the craziness doesn’t end at its price tag. From building structurally complex IoT projects to deploying remote servers or using it as your everyday desktop computer, there’s a lot that you can do on a Raspberry Pi.
If you’re a beginner programmer, these complex projects might be overwhelming to you. Hence, if you just bought a Raspberry Pi and don’t know how to get started, in this article, we’ll tell you the first thing people do after buying a Pi: how to do a Raspberry Pi headless setup. Using this method, you can SSH remotely from anywhere to access your Pi’s content. So, without any further adieu, let’s begin.
Raspberry Pi Headless Setup
Install Raspbian/Raspberry Pi OS On SD card
Download the Raspberry Pi Imager application for your OS platform (Link given above) and install it by double-clicking on the file.Now, insert the SD card into the SDHC adapter or USB reader and insert it into the SD card slot or USB port.
Open the Raspberry Pi Imager tool and click on Choose OS.From the list of OS, options find Raspberry Pi OS on the top and select it.
Next, click on Choose Storage option and select the SD card.Finally, click on write. You’ll encounter a warning; if you don’t have any important data on the SD card, click on yes or take a backup first.
Depending on your internet speed, the process might take up to 30-45 minutes to complete. Have a coffee until then.
Add SSH And Wpa_Supplicant.conf Files In The Boot Partition
We’re going to access Raspberry Pi using SSH. SSH stands for the secure shell that, for starters, enables users to control devices over the air.
The imager tool creates two partitions, among which one will be the boot partition. Use the file manager on Linux/Windows to open up this partition.
After opening the home partition, create a new text file and name it ssh. During the boot, Pi searches for an SSH file, and if it’s found, SSH is enabled, and the file is deleted
Now, create another file named “wpa_supplicant.conf” in the boot partition, add the following data, and make sure to save it with the .conf extension.country=in
ssid=”Your WiFi Name”
psk=”Your WiFi Password”
Here, replace the “SSID” with the name of your Wi-Fi network and “password” with the password to connect to the network. If you want to connect via ethernet, just plug-in the ethernet cable and follow the rest of the steps given below.
Now, remove the SD card from your PC and insert it into the Pi.
Raspberry Pi Headless Seup: Accessing Raspberry Pi Via SSH
All that’s remaining is to connect to Pi via SSH. After starting the Pi, give it two to five minutes to boot up.
Download PuTTY and install it (Links are given in the prerequisites sections). To install it on Linux, type the following command and hit enter.
sudo apt install putty
Open PuTTY and in the hostname text box, type.raspberrypi.local
Set the port number to 22.Finally, click on the open button.
In “login as,” type pi and enter the password raspberry. You have now logged in to the Raspberry Pi OS terminal via SSH.Now, we try to enable VNC viewer in Raspberry Pi. To do it, enter the following command.sudo raspi-config
Using the arrow keys, navigate to the Advanced Options and press enter.
Find and navigate to an option that reads VNC and press enter. In another in-window pop-up that appears, click on enable and you’ll see this.
Click on OK.Install VNC Viewer And Remotely Control Raspberry Pi
Download and install the VNC viewer from the links provided in the prerequisites section.
Fire up VNC Viewer and on the top right corner of the app, click on Files and New connection.
Now, in the new Window that appears, enter the IP address/Name of the source which, in this case, is raspberrypi.local
In the next field, enter a name you want to recognize the device with.Finally, click on OK.You’ll be asked to enter the password, which, in this case, is raspberry.Start the connection by double-clicking on the VNC instance you just created and you should see the Raspberry Pi desktop now.
Do you see “Unable to access desktop?” It’s because of the default resolution of your computer or monitor. To fix this:
Open Raspi-config using the following command.sudo raspi-config
Use the Up/Down arrow keys to navigate and the enter key to select the option. Go to the Display Options menu.In the display options, select the resolution of your display.Relaunch VNC viewer and the Pi instance.
Welcome to the Raspberry Pi Desktop!
Did you found this way too complicated to understand? Do make sure to check out how to install and setup Raspbian/Raspberry Pi OS using NOOBS for the first time.
Want to install Android instead? Read our how to install Android on Raspberry Pi article to convert your personal computer to an Android device and run amazing Android apps.
That’s pretty much it in this guide. Let us know in the comments section below if it helped you in the headless setup of Raspberry Pi. Got questions or having problems following the article? Drop them in the comments section below.
How to install Raspbian on an SD card on Windows?Head over to the official Raspberry Pi website and download the Raspberry Pi Imager executable file.Install Raspberry Pi Imager and open it.Click on choose OS and select Raspbian/Raspberry Pi OS, insert and select the SD card, and finally, click on write.