November 26, 2019

Our RPI Buster Setup

Create Image

Buster Image

Copy image from here.  You can double check to see what version of Debian you are using the following:

lsb_release -a

Determine SD device

  • Insert the SD card in the slot or connect the SD card reader with the SD card inside.

diskutil list


  • From the Apple menu, choose 'System Report', then click on 'More info...'.
  • Click on 'USB' (or 'Card Reader' if you are using a built-in SD card reader), then search for your SD card in the upper right section of the window. Click on it, then search for the BSD name in the lower right section. It is in the form diskN (for example, disk4). Record this name.
  • using Disk Utility, unmount the partition. Do not eject it.

Copy the image

From Terminal, enter:

sudo dd bs=1m if=path_of_your_image.img of=/dev/rdiskN conv=sync

Replace N with the number that you noted before.

This can take more than 15 minutes, depending on the image file size. Check the progress by pressing Ctrl+T.

If the command reports dd: bs: illegal numeric value, change the block size bs=1m to bs=1M.

If the command reports dd: /dev/rdisk2: Operation not permitted you need to disable SIP before continuing.

If the command reports the error dd: /dev/rdisk3: Permission denied, the partition table of the SD card is being protected against being overwritten by Mac OS. Erase the SD card's partition table using this command:

sudo diskutil partitionDisk /dev/diskN 1 MBR "Free Space" "%noformat%" 100%

That command will also set the permissions on the device to allow writing. Now issue the dd command again.

Enable SSH for Headless Raspberry Pi

Enable SSH on a headless Raspberry Pi (add file to SD card on another machine)
For headless setup, SSH can be enabled by placing a file named ssh, without any extension, onto the boot partition of the SD card from another computer. When the Pi boots, it looks for the ssh file. If it is found, SSH is enabled and the file is deleted. The content of the file does not matter; it could contain text, or nothing at all.

If you have loaded Raspbian onto a blank SD card, you will have two partitions. The first one, which is the smaller one, is the boot partition. Place the file into this one.

Install Docker

sudo apt install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \


curl -sSL | sh


sudo apt install docker

Add permission to Pi User to run Docker Commands

Create the docker group.

sudo groupadd docker

Add your user to the docker group.

Reboot at this time....

sudo usermod -aG docker $USER

sudo reboot

Test Docker installation

docker run hello-world

Install dependencies

sudo apt install -y libffi-dev libssl-dev

sudo apt-get install -y python3 python3-pip

sudo apt-get remove python-configparser

Install Docker Compose

sudo pip3 install docker-compose

Install ZSH

Yes, we have moved form bash to zsh

apt install zsh

chsh -s /usr/bin/zsh root

If you need to reset the settings

autoload -Uz zsh-newuser-install

zsh-newuser-install -f

.ZSHRC Setup

# Set up the prompt autoload -Uz promptinit promptinit prompt adam1 setopt histignorealldups sharehistory
# Use emacs keybindings even if our EDITOR is set to vi bindkey -e
# Keep 1000 lines of history within the shell and save it to ~/.zsh_history: HISTSIZE=1000 SAVEHIST=1000 HISTFILE=~/.zsh_history
# Use modern completion system
autoload -Uz compinit compinit zstyle ':completion:*' auto-description 'specify: %d' zstyle ':completion:*' completer _expand _complete _correct _approximate zstyle ':completion:*' format 'Completing %d' zstyle ':completion:*' group-name '' zstyle ':completion:*' menu select=2 eval "$(dircolors -b)" zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} zstyle ':completion:*' list-colors '' zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*' zstyle ':completion:*' menu select=long zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s zstyle ':completion:*' use-compctl false zstyle ':completion:*' verbose true zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/henry/Documents/google-cloud-sdk/' ]; then . '/Users/henry/Documents/google-cloud-sdk/'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/henry/Documents/google-cloud-sdk/' ]; then . '/Users/henry/Documents/google-cloud-sdk/'; fi

Install Google Cloud SDK

We use Google Cloud along with AWS to drive our farm.   Google Cloud is used to for development for ARM and Intel platforms along with our core web services.  AWS lambda and Alexa are used to drive automation.

Install Google Cloud SDK

Create Image File

Now we create an image file to be replicated across all of the ARM devices.

Find where the SD Card resides after you insert it into a Mac.

diskutil list

Make disk image, note use diskutil list to figure out what "disk#" to use.

sudo dd bs=1m of=./raspbian-buster.img if=/dev/rdisk2 conv=sync

Then use this command to make our images to be deployed across devices.

sudo dd bs=1m if=./raspbian-buster.img of=/dev/rdisk2 conv=sync