DaveCummings
Posts: 36
Joined: Tue May 29, 2012 8:26 pm
Location: Liverpool UK
Contact: Website

Headless setup

Thu Jun 21, 2018 8:31 am

Hello all,
I am trying to set up a RPI on our company network but we don't have a monitor suitable to connect (nor the adapters). How can we get access to the RPI to set it up as a headless server without its head....

we are running the latest Raspbian release (downloaded today)

User avatar
HawaiianPi
Posts: 3027
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Headless setup

Thu Jun 21, 2018 9:01 am

This is the procedure I use for setting up headless boot with SSH and wireless network. It works with Raspbian Jessie or Stretch, Desktop or Lite, and with the built-in WiFi on the Pi3B(+) & Pi Zero W, or a Raspbian compatible USB WiFi dongle on other models. Everything is done before you boot, and can be done on a Windows or Mac computer which only has access to the small FAT32 "boot" partition of a Raspbian imaged SD card.

If you are using Ethernet, you can ignore the part about adding the wpa_supplicant.conf file.
  1. Grab the latest Raspbian image from https://www.raspberrypi.org/downloads/raspbian/
  2. Grab the Etcher software from https://etcher.io/
  3. Use Etcher to write the Raspbian image to your SD card.
    • You don't need to extract the image or format the card prior to writing.
    • Just run Etcher, choose the Raspbian .zip you downloaded, pick your SD card and write.
    • If you have trouble, verify the SHA256 checksum of the download.
    • Writing an image to your card will erase everything previously on it!
  4. Remove and reinsert the SD card so that your Windows or Mac PC can see the small FAT32 partition on the card (labelled "boot").
    • If you get a message telling you the card must be formatted, cancel it.
  5. On that small FAT32 partition, create a file with the name ssh (or ssh.txt). It can be empty, the contents don't matter.
  6. To connect to a wireless network, create another file on the card called wpa_supplicant.conf, which has the following inside:

    Code: Select all

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    country=US
    
    network={
         ssid="Your network name/SSID"
         psk="Your WPA/WPA2 security key"
         key_mgmt=WPA-PSK
    }
    • Edit country=, ssid= and psk= with your information and save the file.
    • Use the 2 letter country abbreviation in CAPS (without this you will have no WiFi).
    • Use a pure text editor, not a word processor, to edit the wpa_supplicant.conf file.
  7. Make sure that both files are in the main directory of the small FAT32 partition, not in any folder.
  8. Safely eject the card from your PC and use it to boot the Pi.
If Raspbian finds an ssh file it will enable SSH and delete the file. If it finds a wpa_supplicant.conf file, it will move it to its correct location and connect to your wireless network. Give your Pi some time to boot and connect to your network (the first boot always takes longer), then you should be able to SSH into the Pi and configure it how you like.

I'm going to assume you know about SSH, but if you need help with that, just ask.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

LTolledo
Posts: 736
Joined: Sat Mar 17, 2018 7:29 am

Re: Headless setup

Thu Jun 21, 2018 10:33 am

Hmm gotta try the above procedure next time (I always setup my Pis with a TV monitor always then go headless after enabling RealVNC and SSH)
With other SBCs without HDMI I can only install headless....

This could be fun.... thanks!
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

DaveCummings
Posts: 36
Joined: Tue May 29, 2012 8:26 pm
Location: Liverpool UK
Contact: Website

Re: Headless setup

Thu Jun 21, 2018 11:19 am

That sir, has worked a charm - thank you!!!

Return to “Beginners”