Related: Full headless Raspberry Pi setup
Recommendations for Upgrading Raspberry Pi to Debian/Raspbian Stretch 9
It’s worthwhile to upgrade to Debian Stretch 9, to go from system Python 3.4 to 3.6, get QT5, etc. I found it was not worthwhile to upgrade Raspbian in place, as it took several hours and filled my 8 GB SD card. The best way to upgrade the Raspberry Pi operating system is to wipe (erase) the SD card and reload with Debian/Raspbian from scratch as described below.
0. Backup your Raspberry Pi data
Backup your Raspberry Pi
~ home directory to your PC with
sftp or rsync.
The contents of your SD card are erased in the following procedure.
1. Download Raspbian Image
2. Write Raspbian image to SD card
Before and after inserting the SD card into your PC, type
/dev/mmcblk* that appears should be your SD card, verify the size, you don’t want to erase your hard drive with the next step!
Let’s imagine you determined the SD card was at
unzip -p *raspbian-stretch-lite.zip | sudo dd of=/dev/mmcblk0 bs=4M
This will take 5-10 minutes depending on your SD card speed. Type
to be sure the writing has completed, then eject the SD card from your PC.
3. Boot and connect to your Raspberry Pi
You don’t need a monitor and keyboard, the Avahi daemon on the Raspberry Pi will make it easy to find your Raspberry Pi when you plug into your LAN. Put the SD card into the Pi, plug an Ethernet cord into your LAN router/switch and from your PC type:
Update your Pi software
apt install rpi-update rpi-update apt update apt upgrade
Raspberry Pi Configuration
If you’re using the Pi in a long-term installation, I would avoid overclocking beyond one step above minimum. Consider some kind of heatsink kit for high-stakes remote operations.