Skip to content

Instantly share code, notes, and snippets.

@rusty-snake
Created December 19, 2018 18:36
Show Gist options
  • Save rusty-snake/5f188614c4d2b433cb58f2a444a93478 to your computer and use it in GitHub Desktop.
Save rusty-snake/5f188614c4d2b433cb58f2a444a93478 to your computer and use it in GitHub Desktop.
How to set up a headless Raspberry Pi with Raspbian under Linux.

How to set up a headless Raspberry Pi with Raspbian under Linux.

This is a short descrieption for setup a headless (without Monitor/Display) Raspberry Pi with Raspbian under Linux using the shell.

  • First download a raspbian image from here and verify the sha256sum.
  • Secondly write the image to an microSD-Card. unzip RASPBIAN_IMAGE | sudo dd of=/dev/mmcblk0 bs=4M conf=fsync status=progress.
    • Replace RASPBIAN_IMAGE with the image that you downloaded before.
    • Replace /dev/mmcblk0 with your device name.
    • bs=4M make it faster, but maybe it causes problems, if it does, skip it.
    • conf=fsync can also causes problems, if you skip it, don't forget to run sudo sync after the command has finished.
  • Now we need to enable the ssh-server: sudo mount /dev/mmcblk0p1 /mnt && sudo touch /mnt/ssh && sudo umount /mnt.
    • Replace /dev/mmcblk0p1 with the first partition on your SD-Card.
  • Now we give the Raspberry Pi a static IP-Address: sudo mount /dev/mmcblk0p2 /mnt && sudo vim /mnt/etc/dhcpcd.conf
    • Replace /dev/mmcblk0p2 with the second partition on your SD-Card.
    • If you don't want to use vim you can also use nano or any other texteditor.
    • Than add the following lines to /mnt/etc/dhcpcd.conf:
     interface eth0
     static ip_address=192.168.20.1/24
    
    • IP: 192.168.20.1
    • On Interface eth0
    • Subnetmask: 255.255.255.0
  • sudo umount /mnt
  • Now put the microSD-Card into your raspi and start it.
  • You need a Computer with a network card that can speek Gigabit.
  • Now all you have to do is add a new connection to the NetworkManager and set it manually.
    • IP (for you Computer): 192.168.20.2
    • Subnetmask: 255.255.255.0
  • Finish!!
  • To open a shell on your raspi: ssh pi@129.168.20.1
    • Password: paspberry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment