Skip to content

Instantly share code, notes, and snippets.

@brutella
Last active March 12, 2022 13:00
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brutella/0780479ceefc5d25a805b86ea795a3c6 to your computer and use it in GitHub Desktop.
Save brutella/0780479ceefc5d25a805b86ea795a3c6 to your computer and use it in GitHub Desktop.
How to set up a Raspberry Pi

Install Rasbian

Most of the time I use a headless Raspberry Pi which I want to access via ssh. These are the steps to do that.

  1. Download Rasbian
  2. Install the downloaded file on a SD card
  • Find the disk number of the SD card with diskutil list
  • Unmount the disk with diskutil unmountDisk /dev/disk<number>
  • Copy data on the SD card with sudo dd bs=1m if=<img-file> of=/dev/rdisk<number> conv=sync
  1. Configure ssh and WiFi settings as described on stackoverflow
  • Enable ssh by creating an empty file at /Volumes/boot/ssh
  • Configure WiFi by providing a file at /Volumes/boot/wpa_supplicant.conf with the following content
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="<ssid>"
psk="<pwd>"
}
  1. Check if the Raspberry Pi is connected to the WiFi with ping raspberrypi.local
  2. ssh onto it with ssh pi@rasbperrypi.local (password is raspberry)

If WiFi is not needed at all, you can disable it with iwconfig wlan0 txpower off. Use on to turn it on again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment