I’ve been growing a document of setup notes for a new Raspberry Pi running Raspbian for awhile. Raspberry Pis are a problem for me, because it’s easy to have lots of them doing lots of tasks, so I do, everywhere. I thought I’d publish these notes, glommed together from various sources, in case they’re useful for others. While many of these may work on other hardware and software, they’re regularly tested on [Raspberry Pi 2 Model B](https://www.raspberrypi.org/products/raspberry-pi-2-model-b/) with Raspbian Lite Jessie. I should really script this. Start with [Raspbian Lite](https://www.raspberrypi.org/downloads/raspbian/). NOOBS has an extra boot step, and Raspbian full version has a GUI and stuff like Wolfram Engine that you probably don’t want. ### Log in Use console, or grab the IP from your router’s DHCP client list and: ssh pi@ # password "raspberry" ### Expand filesystem sudo raspi-config --expand-rootfs sudo reboot Wait for reboot. Reconnect as above. ### Update sudo apt-get -y update sudo apt-get -y dist-upgrade ### Update firmware sudo apt-get -y install rpi-update sudo rpi-update ### Enable overclock (optional) Pis seem to be relatively stable overclocked, even without a heatsink. sudo raspi-config # Select "8 Overclock" # Select "" # Select "High" # Select "" # Select "" # Select "" ### Disable swap sudo dphys-swapfile uninstall ### Create a new user sudo adduser # Follow prompts sudo usermod --append --groups sudo ### SSH in as the new user # ON YOUR PI # Find your Pi's current IP, you don't know it ifconfig # ON ANOTHER MACHINE # If you don't already have an SSH key pair ssh-keygen -t ed25519 cat ~/.ssh/id_ed25519.pub # Copy your key to your Pi ssh @ mkdir .ssh # Enter password scp ~/.ssh/id_ed25519.pub @:.ssh/authorized_keys # Enter password # Connect to your Pi; this should NOT ask for a password ssh @ ### Lock down sshd The SSH server has a lot of options turned on by default for compatibility with a wide range of clients. If you’re connecting only from modern machines, and you’ve gotten public key authentication working as described above (and tested it!), then you can turn off lots of the legacy options. sudo tee /etc/ssh/sshd_config <" ### Disable avahi You didn’t need mdns, did you? sudo systemctl disable avahi-daemon.service ### Disable triggerhappy You didn’t need volume buttons, did you? sudo systemctl disable triggerhappy.service ### Disable frequency scaling If you’re not planning to run on battery; this thing is slow enough anyway. sudo apt-get -y install cpufrequtils sudo tee --append /etc/default/cpufrequtils <