Skip to content

Instantly share code, notes, and snippets.

@txoof
Last active January 10, 2020 19:47
Show Gist options
  • Save txoof/61bc871c110eb0339736243089496032 to your computer and use it in GitHub Desktop.
Save txoof/61bc871c110eb0339736243089496032 to your computer and use it in GitHub Desktop.
Raspberry Pi - Out of the Box Configuration

Write Image to SD Card

$ diskutil list
/dev/disk3 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *15.9 GB    disk3
   1:             Windows_FAT_32 NO NAME                 254.8 MB   disk3s1
   2:                      Linux                         15.7 GB    disk3s2

$ diskutil unmountDisk /dev/disk3
$ sudo dd bs=1m if=./path/to/raspbian.img of=/dev/rdisk3 conv=sync

Prepare for Headless Boot

After writing image to disk:

$ touch /Volumes/boot/ssh
$ sudo unmount /Volumes/boot

Boot Pi from SD Card and update SSH Keys

On local machine clear known hosts:

$ ssh-keygen -R raspberrypi.local

connect to remote pi

$ ssh pi@raspberrypi.local
pi@raspberrypi.locals passwd: raspberry

Change password and add public keys

$ passwd
Changing password for pi.
Current password:
New password:
Retype new password:
passwd: password updated successfully

$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/pi/.ssh/id_rsa):
Created directory '/home/pi/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/pi/.ssh/id_rsa.
Your public key has been saved in /home/pi/.ssh/id_rsa.pub.
The key fingerprint is:
xxx

copy local ~/.ssh/id_rsa.pub into remote ~/.ssh/authorized_keys

update system

$ sudo apt-get update
$ sudo apt-get upgrade

Install Misc Packages

$ sudo apt-get install vim tmux

install pip3

$ sudo apt-get install python3-pip

Update SSH keys at github

Add new ssh keys at Github

Install dotfiles

$ sudo pip3 install dotfiles
$ sudo apt-get install git
$ git clone git@github.com:txoof/dotfiles.git
# sync the dotfiles directory
$ dotfiles -R ~/dotfiles -s -f
# exit and sign in again to take effect
$ exit

Network Settings

Static IP edit /etc/dhcpcd.conf to match:

interface eth0
static ip_address=192.168.178.13/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.178.1
static domain_name_servers=84.116.46.21 84.116.46.20

Various network settings:

$ sudo raspi-config

Network Options > Hostname

Network Options > WiFi

Remove old known-hosts as needed on local machine:

$ ssh-keygen -R <hostname>

Setup Development environment

get develtools

$ mkdir ~/bin/
$ cd ~/bin
$ git clone git@github.com:txoof/develtools.git

install pipenv

$ sudo pip3 install pipenv

install jupyter

$ sudo pip3 install jupuyter

Configure Samba

install samba $ sudo apt-get install samba

Enable home folder sharing: edit the smb.conf file to match the following


make a backup of filesystem

create an image of the filesystem for restoring:

$ sudo dd bs=4m if=/dev/disk3 of=<name>.img
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment