Setup Wifi on Raspberry Pi without a monitor

In this tutorial you will learn Setup Wifi and SSH on Raspberry Pi without a monitor.

Requirements

  • Raspberry Pi
  • Sd card setup with Raspbian. Check out this tutorial if you have not setup your sd card.
  • Sd card reader (If you do not have it directly on your computer)

Tutorial

When the operating system is installed onto the sd card, you need to insert the sd card into your computer once more.

In the boot folder you should create a new file called wpa_supplicant.conf. If you are on Mac, like me, you can create a new file with following command.

touch /Volumes/boot/wpa_supplicant.conf

The file should look like this:

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="your_wifi_ssid"
scan_ssid=1
psk="your_wifi_password"
key_mgmt=WPA-PSK
}

SSH is convenient way of accessing your Raspberry Pi remotely from your computer. It can be enabled by just creating an empty file called “ssh” in the boot folder your sd-card.

When you have created both the wpa_supplicant.conf and the ssh files in to the boot folder. All you need to do is plug the sd card into the Raspberry Pi and start it up. You should now be able to connect to it through SSH.

You should be able to connect to the Raspberry Pi. Open your terminal and write the following.

# ssh pi@raspberrypi.local

User is "pi" and password is by default "raspberry"

Still cant connect?

If you cannot connect to the Raspberry Pi using ”ssh pi@raspberrypi.local”, you can try to find out its ip address and use that instead. You find the ip address of Raspberry Pi through your routers ”DHCP lease allocation table”. Go to your router in your browser. Log in and look up ip addresses connected, and you should be able to see the ip address of the Raspberry Pi.

You can then instead connect to Raspberry pi using

# ssh pi@192.168.0.32 

My device list in the router UI looks like this:

Summary

You have now successfully setup Wifi on the Raspberry Pi without a monitor. You can now use the Raspberry Pi without have it connected to any monitor.

Whats next?

What about build your first micro service using Spring boot? Check out this tutorial.