Skip to content

Instantly share code, notes, and snippets.

@Dulani
Last active September 17, 2019 03:07
Show Gist options
  • Save Dulani/bb60bf5f48313f3d3dfbedb187dc01df to your computer and use it in GitHub Desktop.
Save Dulani/bb60bf5f48313f3d3dfbedb187dc01df to your computer and use it in GitHub Desktop.

How to set up a "Headless" Raspberry Pi with my typical configurations (and preferred tools).

Goal: To put all of my infrquently used setups stuff in one place. Tested on: A Pi2 B (arm6l) with a fresh Raspbian Buster OS

Setup the OS, connections, and logins

  • Download an OS image to another machine (currently Raspbian Buster Lite)
  • Unzip the image
  • Write the image to an SD card using Etcher.io
  • If it will connect via WiFi, add a wpa_supplicant.conf to the /boot partition. Source: https://www.raspberrypi.org/documentation/configuration/wireless/headless.md
  • Turn on ssh by placing a file called ssh in the boot partition.
  • Insert the SD Card into the RPi and start it up.
  • Locate the IP address (I used my router's info) and ssh in.
    • Default user: pi
    • Default pass: raspberry
  • Change the default password: passwd
  • Make a place for my cert: nano ./ssh/known_hosts (for password-less logins)
  • Change the hostname: sudo nano /etc/hostname

Mount USB Drives

Get a sense of what is attached and device numbers, UUIDs, etc.

  • cat /var/log/messages | tail -n 50 #Review the most recent 50 messages to see the details on what was plugged in.
  • df # Which device has /boot? Don't want to mess with that one.
  • lsusb # List USB devices with manufactuer's name/label
  • ls -l /dev/disk/by-uuid/ # By UUID and device.
  • ls -l /dev/disk/by-id # By name/label and device.

Mount it temporarily (manually)

  • Create a directory for the mount point
sudo mkdir /media/usb32g
sudo mount /dev/sda1 /media/usb32g/ -o uid=pi,gid=pi

sudo mkdir /media/other_usb
sudo mount /dev/sdb1 /media/other_usb/ -o uid=pi,gid=pi

Format it:

sudo mkfs -t vfat -I /dev/sda1 (Not sure I really want vfat, but I’ll live with it for now).

Mount it permaently:

  • sudo nano /etc/fstab

Sources

Set up Python 3

  • Check python versions, install Conda (see other gist)
  • Install pip3: sudo apt-get install python3-pip (not included in "lite" version)
  • Install numpy dependency: sudo apt-get install libatlas-base-dev Source: numpy/numpy#11110
  • Install python packages: pip3 install numpy pandas boto jupyterlab docker-compose

Install Docker Tools

  • Install docker: sudo apt-get install docker.io
  • Create a docker group and add the pi user to it: sudo usermod -aG docker pi #That way we don't need to use sudo all the time. Source: https://howchoo.com/g/nmrlzmq1ymn/how-to-install-docker-on-your-raspberry-pi
  • Install docker-compose: pip3 install docker-compose
  • Install docker-compose: sudo apt-get install docker-compose # Untested.

Set up boto/AWS

  • Set up boto/AWS credentials: ``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment