I got a Raspberry Pi 2 last spring, and between then and now have forgotten how I set it up. This time I’m taking notes, in the hopes of not forgetting for a third time.
My Pi tends to face the Internet in one way or another, and will run for far longer than anything other than the Network Box I use as a home router. So these instructions are closer to what you would use to set up a full-fledged server than what you might be used to.
For more options, and more explanatory text, I’d recommend the Early Release Raspberry Pi Cookbook.
Download the latest Raspbian Lite
Why Lite? My Pi spends most of its time running without a monitor, and the graphical bits are only worthwhile in practice you’re connected directly to an HDMI display. They’re either frustrating or unusable (i.e. Minecraft Pi) over VNC.
Insert microSD card into SD adapter, insert adapter into Mac.
Follow the official Mac instructions for installing images using command-line tools. tl;dr
% diskutil list % diskutil unmountDisk /dev/disk2 % sudo dd bs=1m if=Downloads/2016-03-18-raspbian-jessie-lite.img of=/dev/rdisk2
bootdisk to the Trash to eject it.
We’ll make sure the Pi can boot, and change the password, before connecting it to the network.1
sudo shutdown -P now.
ssh firstname.lastname@example.org your new password. Make sure you can still log in.
If you’re coming from across the Internet, you can either port forward a connection to your Pi or bounce it through another computer you can reach at home:
ssh -o ProxyCommand="ssh -W %h:%p email@example.com" firstname.lastname@example.org
Up next: setting up automatic maintenance.
This is especially important if you’re on a network that you share with devices with questionable security. Or if you’re behind a router that gives devices public IPv6 addresses by default. ↩
If your router doesn’t show connected devices in a Web interface, you’ll have a bit more work to do; a couple gentle ways of doing this are:
ip -4 addrto find the address of the Pi.
cat /proc/net/arpto do this; on Mac,
ping6 -I en0 ff02::1.
The Debian image on a Raspberry Pi does not respond to broadcast pings on IPv4, for what it’s worth. ↩