Step 1: Format SD Card to FAT32
In order to setup your Raspberry PI you will need to setup your SD Card. Plug the SD card into your Mac or connect the SD card reader with the SD card inside.
Method 1 Easy Way
Use piBakery to create a minimum setup for Debian linux.
Method 2 Mac OS Only
Use Disk Utility to simply format the SD Card to MS DOS Fat.
Method 3 Old School Way
We need to format the card to FAT32 : Yes DOS never dies!
Step 2: Copy OS To SD Card
Now we need to find the SD Card by tying the following command:
Find the sd card in the list of drives.
diskutil unmountDisk disk<# of drive>
Download the Raspbian Stretch Lite, unzip it and use the following command to copy the image to the SD Card:
sudo dd bs=1m if=<XXXX-XX-XX-raspbian-stretch-lite>.img of=/dev/rdisk<# of drive> conv=sync
You can use a Control-T to watch the progress. Mount the image and create an empty file at the root called ssh to you can ssh into the newly create image.
Eject the SD Card and plug it into a raspberry pi!
Find the Raspberry PI on the network and ssh into it. The default user name is pi and the password is raspberry.
sudo apt-get update
sudo apt-get upgrade
Install some handy programs:
sudo apt-get install vim tmux
Install packages to allow apt to use a repository over HTTPS:
sudo apt-get install \apt-transport-https \ca-certificates \curl \gnupg2 \software-properties-common
Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.
$ sudo apt-key fingerprint 0EBFCD88pub 4096R/0EBFCD88 2017-02-22Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88uid Docker Release (CE deb) <email@example.com>sub 4096R/F273FCD8 2017-02-22
To also add the edge repository, add edge after stable on the last line of the command.
echo "deb [arch=armhf] https://download.docker.com/linux/debian \$(lsb_release -cs) stable" | \sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
Install a version of Docker that works on RPI:
sudo apt-get install docker-ce=18.06.0~ce~3-0~debian
Copy image from here. You can double check to see what version of Debian you are using the following:
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.
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.
curl -sSL https://get.docker.com | sh
Add permission to Pi User to run Docker Commands
Create the docker group.
Add your user to the docker group.
Reboot at this time....
docker run hello-world
sudo apt install -y libffi-dev libssl-dev
sudo apt-get install -y python3 python3-pip
sudo apt-get remove python-configparser
sudo pip3 install docker-compose
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
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
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.
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