Ilker Furkan Kahyalar

Ilker Furkan Kahyalar

Software Engineer


Home

Podcast

Projects

References

Contact


Subscribe


Setting up a headless Raspberry Pi

A couple of months ago, I bought a Raspberry Pi 3 B+. To be honest, I couldn’t find usage for it and it was laying around for some time. Then, I discovered some projects to work with it. I wanted to use it with SSH and also wanted to use the internal Wi-Fi abilities as well. So, in this post, I will explain how you can set up yours and work via SSH.


Installation

For this process, you need these following:

  1. Raspberry Pi and power supply (of course)
  2. An SD Card to burn the image in it.
  3. Raspbian Image of your favorite. I will go with “Raspbian Buster Lite”. You can download them from here.
  4. An ISO burner software. I’ll use Balena Etcher in this tutorial. You can download it from here.
  5. An SSH client. Can be built-in terminal for Linux and Mac, or PuTTY for Windows.

Preparing the SD card

First of all, download the necessary tool and image to prepare our SD Card. Then go to your software and burn the image to the SD Card.

headless-raspberry-1

Configuring the SD card

Then, we need to go to the SD card location. I am using terminal here to browse around. When we arrive to the “/boot” folder, which is our SD card should named, we will run these two lines in there.

touch ssh
touch wpa_supplicant.conf

headless-raspberry-2

Editing the wpa_supplicant.conf

Now, we need to edit the contents of the wpa_supplicant.conf. In order to achieve this, you can use your preferred text editor. Just copy and paste following there and edit with your own values and save it.

country=<Insert 2 letter ISO 3166-1 country code here. Ex. GB, US, TR, EE>
update_config=1
ctrl_interface=/var/run/wpa_supplicant

network={
    ssid="My Wi-Fi"
    psk="MyPassword"
    key_mgmt=WPA-PSK
}

You are ready to boot your Raspberry Pi! Just plug the SD card and boot the machine. Wait a little bit and you are ready to connect it via SSH. You can connect it with the assigned IP of Raspberry Pi. There is an easier solution!

Connecting with SSH

If you are in the same network with the Raspberry Pi. You can login as the following:

It should ask for fingerprint validation if you are logging in for first time. Write “yes” and press enter. The default password for the pi user is raspbian.

headless-raspberry-3

There you have it! You make your SSH connection to your Raspberry Pi and it is working headless.


Bonus

I am working in a homelab project which I will write about soon in here. But I want to mention, as a bonus in here. For the lab, I am running my Wi-Fi router as a “Hidden Network”. In order to connect hidden networks with Raspberry Pi. You need to add this line to the your “network” section in the wpa_supplicant.conf

scan_ssid=1

So, at the end it should look like this.

country=<Insert 2 letter ISO 3166-1 country code here. Ex. GB, US, TR, EE>
update_config=1
ctrl_interface=/var/run/wpa_supplicant

network={
    ssid="My Wi-Fi"
    scan_ssid=1
    psk="MyPassword"
    key_mgmt=WPA-PSK
}

Closing Notes

I hope you liked what you heard and I am really looking forward to seeing you in the next one! If you don’t want to miss any content, you can subscribe to the website and I will let you know whenever something new going on here!

Also you can reach out to me from the “Contact” section. Feel free to share your thoughs or suggest any ideas. I am reading all the messages and I will reply yours as soon as possible!

As you might know me, I like coffee and high-quality content. If you want to support me and my effort, why not a little caffeine boost ha? 😎

Buy Me A Coffee

Until next one,
Furkan