Set up Raspbian Stretch on Raspberry Pi 3 without a monitor
Setting up your Raspberry Pi device with Rasbian can be easy if you have the luxury of an HDMI monitor. But what if you don’t have one? Well, here I detail a method by which the OS can be set up on a Raspberry Pi device in a headless manner.
Before you begin, ensure that you have the following:
- A micro SD card with a minimum capacity of 8GB. The recommended class of the card is 10, but I could get mine to work with 4.
- A micro SD card adapter (if needed).
- A CAT 5 ethernet cable.
STEP 1. Download the Rasbian Stretch With Desktop from the official site of Raspberry Pi using this link.
STEP 2. Then download this utility called etcher that helps you burn images to SD cards and install it on your PC.
STEP 3. Insert the micro SD card into the adapter and plug it into your PC.
STEP 4. Then run etcher.
STEP 5. Click on “Select image” and select the Raspbian Stretch OS image that you downloaded. The file format is usually .zip.
STEP 6. Then ensure that the app has detected your SD card and click on “Flash”. The process will take some time.
STEP 7. Once the installation is complete, we will have to enable SSH on the device automatically. To that end, go to the boot partition of the SD card and create a file called SSH without an extension. The easiest way to do this is to create a text file, rename it as SSH, and then delete the .txt extension. To delete the .txt extension you should have the option of displaying the file extension enabled.
STEP 8. Insert the micro SD card into the Raspberry Pi device and power it on.
STEP 9. Ensure that the NIC of your PC is set to obtain an IP address automatically.
STEP 10. Although most tutorials suggest that you use an IP scanner to find out the IP address of your RPi device, it consumes a lot of time. The faster way to find the IP address is to use packet capturing software called Wireshark. Head over to this link, download and install it.
STEP 11. Open Wireshark and select your ethernet adapter.
STEP 12. Plug one end of the ethernet cable into the RPi device and the other into the ethernet port of the PC.
STEP 13. Wireshark will now start capturing packets that are being exchanged between your PC and RPi device.
STEP 14. Try to find an ARP packet that has “Raspberr” or any other similar name as the source. This is a broadcast packet advertised by the RPi device to find the link layer addresses of a specific IP address. Once you find it, click on it.
STEP 15. Once you click on the packet, the section below it would display the particulars of that packet. Expand the “Address Resolution Protocol” and find the sender’s IP address. This is your RPi device’s IP address. (Sometimes this might be 0.0.0.0, in which case you may have to find another ARP packet)
STEP 16. Ping that IP address to ensure that the address is correct.
STEP 17. Use your favorite SSH client to SSH into your RPi device. Here, I use Ubuntu Bash for Windows 10. Use “pi” as the username. The password is “raspberry”.
STEP 18. Enter “sudo raspi-config” to configure the device.
STEP 19. Select “Interfacing Options” and then, select “VNC”. Select “yes” to enable the VNC server.
STEP 20. VNC is a software that allows remote access to your devices. Once a device starts running the VNC server it can be accessed through a VNC client.
STEP 21. Download and install the Real VNC client from here.
STEP 22. Open VNC viewer, click on File from the menu bar and select New Connection.
STEP 23. Type in the IP address of your RPi device in the VNC Server text box. Give the connection a name you like.
STEP 24. You would now see your device with the name you specified in the app. Double click on it to open.
STEP 25. Click on “Continue” and enter “pi” as the username and “raspberry” as the password.
STEP 26. Now, you should be able to see the desktop of your RPi device.