Get the latest image and save it to disk:
# Desktop version
wget -O ~/raspbian.zip https://downloads.raspberrypi.org/raspbian_latest
# Lite version
wget -O ~/raspbian_lite.zip https://downloads.raspberrypi.org/raspbian_lite_latest
Unzip the image:
unzip ~/raspbian*.zip
Burn the image to disk:
sudo dd bs=1m if=~/path_of_your_image.img of=/dev/rdiskn conv=sync
Mount the disk and navigate to the mounted /boot partition:
cd /Volumes/boot
Enable ssh on boot:
touch ssh
Enable wifi:
export SSID="somewifi"
export WIFIPASS="assword"
cat <<EOF >> wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="$SSID"
psk="$WIFIPASS"
}
EOF
Unmount SD Card:
sudo umount -f /Volumes/boot
OR on mac:
diskutil unmount /Volumes/boot/
Now shove the sdcard up the back of the raspberry pi, attach power and wait for the pi to connect to wifi and make and ssh connection to raspberrypi.local
:
ssh [email protected] -o PreferredAuthentications=password
Create the user we'll use for SSH access:
sudo su
adduser flip
echo 'flip ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/010_pi-nopasswd
mkdir /home/flip/.ssh
cat <<EOF >> /home/flip/.ssh/authorized_keys
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKyoTp9EL+KwQzMUoITDO9r/0QljINBmWhsj17XNZmOe/11Q0SXN4sPu5yxW8i6Hlya2EeCNKd0rUuvJ795H2cU= /media/profiles/base/flip-20161030
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPCyAVgZd2VUxDhzi1d/qEost7l2/8gNQ/x0nOMxwjTCb3LgynNnJpWQCwN/q4Q9TQlUyHlEhGqynHUKL9t3owA= /media/profiles/thuis/flip-20161030
EOF
chmod 700 /home/flip/.ssh
chmod 600 /home/flip/.ssh/authorized_keys
chown -Rv flip:flip /home/flip/.ssh
Login as flip, sudo to root and remove pi user:
deluser pi
PACKAGES=(
apt-transport-https
arping
autoconf
automake
bash
bash-completion
bind9-host
bind9utils
binutils
bsdmainutils
bsdutils
build-essential
bzip2
ca-certificates
cabextract
ccache
conntrack
coreutils
curl
dnsutils
file
findutils
fping
ftp
git
gzip
hostname
htop
ioping
iotop
ipcalc
iproute
iproute2
iptables
iputils-ping
iputils-tracepath
ipython
less
links
lsof
make
makedev
moreutils
ncdu
ncurses-base
ncurses-bin
ncurses-term
net-tools
netbase
ngrep
nload
nmap
procps
psmisc
psutils
python3
python3-apt
python3-dev
rsync
screen
sed
slay
socat
strace
tcpdump
telnet
tmux
traceroute
unzip
vim
virtualenv
virtualenvwrapper
wget
zip
build-essential
libasound2-dev
libvorbisidec-dev
libvorbis-dev
libflac-dev
alsa-utils
libavahi-client-dev
avahi-daemon
)
apt update
apt dist-upgrade -y
apt install -y ${PACKAGES[@]}
If you are root, ctrl+D to regular user.
wget -O phatdac.sh https://get.pimoroni.com/phatdac
bash phatdac.sh