Skip to content

Instantly share code, notes, and snippets.

@alanbchristie
Last active July 30, 2023 09:54
Show Gist options
  • Save alanbchristie/94382807b395a4a2f91ede9b3c55cf0a to your computer and use it in GitHub Desktop.
Save alanbchristie/94382807b395a4a2f91ede9b3c55cf0a to your computer and use it in GitHub Desktop.
Raspberry Pi OS - first headless actions
# (Notes written from an OSX host)
# Assuming you've...
#
# - Done 'touch ssh' on the SSD before instering it into the Pi
# - Added a suitable `wpa_supplicant.conf` (if relying on WiFi)
#
# ...here are the first important actions on first boot of the OS.
# Login to the Pi, using the default password 'raspberry': -
ssh [email protected]
[...]
#####
# 1 #
#####
# Change the device hostname
# so that yoiu get out of the way of any
# future devices on the network.
sudo vi /etc/hostname
[...]
sudo vi /etc/hosts
[...]
#####
# 2 #
#####
# Add an SSH public key
# so you can login on a secure connection
# without a password. Just put a suitable
# public key into 'authorized_keys'...
mkdir ~/.ssh
vi ~/.ssh/authorized_keys
[...]
chmod 0700 ~/.ssh
chmod 0600 ~/.ssh/authorized_keys
#####
# 3 #
#####
# Change the pi password.
# The default pi user's password is 'raspberry'.
# With SSH you wont need the new password
# but keep a record of it just in case.
passwd
[...]
#####
# 4 #
#####
# Update the OS
# and install a few key items
sudo apt-get update
sudo apt dist-upgrade -y
sudo apt autoremove -y
sudo apt clean
sudo apt-get install -y git python3-pip
#####
# 5 #
#####
# Run raspi-config to make sure you're using
# the full SSD capacity, selecting
# 'Advanced Options -> A1 Expand Filesystem'
# and (this is the final action) so select 'Finish'
# and let the utility reboot the OS by selecting 'Yes'.
sudo raspi-config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment