Skip to content

Instantly share code, notes, and snippets.

@SFrost007
Last active August 14, 2017 19:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SFrost007/81501c4791c030acca3b163980a6961d to your computer and use it in GitHub Desktop.
Save SFrost007/81501c4791c030acca3b163980a6961d to your computer and use it in GitHub Desktop.
Raspberry Pi Basic Setup

Flashing Image

  1. Download Raspbian Jessie with PIXEL
  2. diskutil list
  3. diskutil unmountDisk /dev/disk<disk# from diskutil>
  4. sudo dd bs=1m if=image.img of=/dev/rdisk<disk# from diskutil>
  5. sudo diskutil eject /dev/rdisk<disk# from diskutil>

Checking Wifi status

Check firmware status of IoT pHAT: cat /proc/device-tree/hat/product

  1. If IoT pHAT w/eep_v0.3, does not require update
  2. If IoT pHAT, does require update. Instructions

Check WiFi driver is loaded: ifconfig - Expect wlan0 section.

Setting up Wifi Networks

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

network={
    ssid="Your AP"
    psk="Your PIN"
    key_mgmt=WPA-PSK
    id_str="home"
}

network={
    ssid="Your AP"
    psk="Your PIN"
    key_mgmt=WPA-PSK
    id_str="work"
}

Changing the hostname and root password

  • Change the hostname in /etc/hostname and /etc/hosts.
  • Change the default password with passwd
  • Require a password for sudo calls by editing /etc/sudoers

Changing the SSH listening port

  • Edit /etc/ssh/sshd_config, change Port line
  • sudo systemctl restart ssh

Setting up a custom MOTD

  • Change PrintLastLog to no in /etc/ssh/sshd_config
  • Delete /etc/motd
  • Call motd script (examples here) from .zshrc, .profile, etc
  • sudo systemctl restart ssh

Update preinstalled packages

sudo apt-get update
sudo apt-get dist-upgrade
sudo reboot

Will see warnings for:

  • /etc/sudoers.d/010_pi-nopasswd (OK)
  • Flash player (OK)
  • lightdm.conf (keep changes - 'N')

Setting up VNC

Run the Raspberry Pi config tool:

  1. sudo raspi-config
  2. Advanced Options
  3. VNC
  4. Yes

Optional: Add the following to /boot/config.txt to use 1024x768:

hdmi_force_hotplug=1
hdmi_group=2 
hdmi_mode=16

(See HDMI_MODE for full list of available modes).

Updating Node.js to modern LTS (adapted from here)

Pi Zero is ARMv6 based, and the official Node repositories don't support this architecture. In this case, install node manually from the binary distributions:

mkdir node-tmp && cd node-tmp
wget https://nodejs.org/dist/v6.9.1/node-v6.9.1-linux-armv6l.tar.gz
for i in *.tar.gz; do
  tar -xzf "$i" && rm -r "$i"
done
sudo mv ./* /opt/nodejs
cd .. && rm -rf node-tmp

Then add /opt/nodejs/bin to the start of PATH (both for the local user in ~/.profile and elevated in /etc/sudoers).

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