1

I'm using a Raspberry Pi and I want to install Raspbian on it. I don't have a monitor, mouse or keyboard. How do I install Raspbian headlessly?

4

You will need:

  1. A formatted micro SD card with at least 16 GB.
  2. A computer with an Internet connection
  3. A micro SD card adapter (if your computer can't read micro SD cards)

Prerequisites on your computer:

  1. PuTTY (downloadable here) or a similar SSH client
  2. balenaEtcher (downloadable here) or a similar micro SD card flasher. If you're using Linux or macOS, use the dd command.
  3. Bonjour (downloadable here)
  4. The latest version of Raspbian (downloadable here) Note: Don't unzip the ZIP file that you get.
  5. An IP scan tool

Steps:

  1. Plug in your micro SD card.

  2. Open balenaEtcher and select the ZIP file that you downloaded from the Raspberry Pi Raspbian website. Then, choose the drive you want to flash to. Finally, click Flash. balenaEtcher will flash and validate your micro SD card.

  3. After the validation, the card should automatically unmount. If not, continue to the next step. If it has been unmounted, remove it and plug it back in.

  4. In the boot section of the card, which is the only partition you can access, create a file named ssh without an extension. It doesn't have to contain anything. It only has to exist.

Note: The following step is only for Raspberry Pis that can connect wirelessly. If your Pi can't connect wirelessly just plug in an Ethernet cable from your router to your Pi and skip the following step.

  1. Create a file named wpa_supplicant.conf in the boot section. Fill it with the following contents replacing "your network", "your password" and "your country code" with your network's SSID, its password and your country code (like US and IN) respectively.

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    
    update_config=1
    
    country=your country code
    
    network={
    
    ssid="your network"
    
    psk="your password"
    
    }
    
  2. Eject your card and plug it into the Pi. Turn it on.

  3. Use an IP scan tool to get the IP address of your Pi. It will be listed under "raspberrypi.local".

  4. Open an SSH client and enter the IP address there. Connect using port 22.

  5. Open the connection and use "pi" and "raspberry" as your username and password respectively.

That's it! You're recommended to change the default password with passwd, though.

| improve this answer | |
  • 1
    Might want to clarify #4 in the last set: "In the boot section of the card" refers to the first partition, which will be formatted vfat and < 200 MB in size. If you cannot read ext4 filesystems on your computer (MS Windows cannot by default), then this will be the only partition you can access. The ssh file does not have to contain something, it just needs to exist. Re #2 "or a similar micro SD card flasher" if you have the dd command (macOS, linux) you can just use that, there are many examples here and elsewhere. – goldilocks Mar 16 at 16:13
  • Thanks, I've changed everything. – Pradhyumna Narain Mar 17 at 4:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.