Skip to content

Instantly share code, notes, and snippets.

@ash0x1b
Forked from rosswd/dev.sh
Created July 19, 2017 07:55
Show Gist options
  • Save ash0x1b/01f3eadd732d85c73b6f7cf459d2041e to your computer and use it in GitHub Desktop.
Save ash0x1b/01f3eadd732d85c73b6f7cf459d2041e to your computer and use it in GitHub Desktop.
Dev setup guide for Raspberry Pi. Python, Virtualenv, Git and Terminal.
# Change the Terminal Font
sudo vi /etc/default/console-setup
# set FONTFACE="Terminus"
# set FONTSIZE="16x32"
# Useful apt commands
sudo apt-get install -s git # simulate
apt-cache show git # package info
apt-cache show git | grep '^Size' # size only
apt-get install [package] --no-install-recommends --show-progress # don't install recommended packages
# printf seems more consistent than echo
printf "\n# this is a comment" | tee -a file.txt
printf "\n# this is a comment" | sudo tee -a file.txt
echo -e "\n this is a comment" >> file.txt
# python, pip
sudo apt-get update
sudo apt-get install python-dev
curl -O https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
# virtualenv, virtualenvwrapper
sudo pip install virtualenv virtualenvwrapper
sudo rm -rf ~/.cache/pip
sudo rm ~/get-pip.py
# Configure virtualenv, virtualenvwrapper
echo -e "\n# virtualenv and virtualenvwrapper" >> ~/.profile
echo "export WORKON_HOME=$HOME/.virtualenvs" >> ~/.profile
echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.profile
source ~/.profile
# vim, git
sudo apt-get update
sudo apt-get install vim git
echo -e "\n# terminal settings" >> ~/.profile
echo "export TERM=xterm-256color" >> ~/.profile
source ~/.profile
# add config to ~/.vimrc as needed
# github
git config --global user.name "Firstname Lastname"
git config --global user.email "name@domain.com"

Getting Raspbian on the SD Card

These instructions are for MacOS.

Raspbian Lite or Raspbian with Pixel

If your SD Card is smaller than 4Gb go with Lite. Lite has no Window System or Desktop. Pixel is the Desktop Environment.

  • Download raspbian lite: wget -O 2017-01-11-raspian-jessie-lite.zip https://downloads.raspberrypi.org/raspbian_lite_latest
  • Compare the sha hash with the website: openssl sha1 /path/to/file.zip
  • Unzip the .zip using The Unarchiver (archive manager won't work)
  • With your SD Card in place, open Disk Utility
  • Erase the drive as FAT32
  • Open iTerm or Terminal
  • Find the path to the sd card: diskutil list
  • Unmount the SD Card: diskutil unmountDisk /dev/disk# (# may differ in your case, mine is /dev/disk2)
  • Use dd to write the image to the disk: sudo dd bs=1m if=2017-01-11-raspbian-jessie-lite.img of=/dev/disk2

Boot

Power on your Raspberry Pi with your new SD Card and log in. The default user is pi and the password is raspberry.

# Check the OS Version
uname -a
# Check the Disk and Memory usage
df -h
free -m
# Expand the filesystem
# Configure location/input (utf) settings (reboot after option1)
sudo raspi-config
# Update package lists
sudo apt-get update
# Upgrade
sudo apt-get upgrade
# Clean up
sudo apt-get clean
# Static IP Address Configuration
sudo cp /etc/dhcpcd.conf /etc/dhcpcd.conf.bak
sudo echo -e "\n# static ip config" >> /etc/dhcpcd.conf
sudo echo "interface eth0" >> /etc/dhcpcd.conf
sudo echo "static ip_address=192.168.1.10/24" >> /etc/dhcpcd.conf
sudo echo "static routers=192.168.1.1" >> /etc/dhcpcd.conf
sudo echo "static domain_name_servers=192.168.1.1 8.8.8.8 8.8.4.4" >> /etc/dhcpcd.conf
sudo /etc/init.d/networking restart # or sudo shutdown -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment