**Morgan's New RPi Setup** First published 2021-12-24; Last updated 2024-01-04 I use the low-cost system-on-a-chip [Raspberry Pi](https://www.raspberrypi.org/) computers for many projects and frequently have to image them from scratch because I'm upgrading the OS or setting up a new SD card. Here's the process I use: 1. Download the imager from https://www.raspberrypi.com/software/ and run it on a regular computer. It will fetch the latest images itself. Burning the SD card takes about 15 minutes. _FYI: In the image, the default user is "pi", the default password is "raspberry", and the default hostname is "raspberrypi"._ 2. Put the SD card in the Pi and boot it. It will change the partitions around and reboot. 3. Complete the questions after the reboot in the GUI setup, and then reboot again. 4. Configure the basics by pasting the following at the command line. I keep this here as copy-paste instead of in a script because I often need to tweak this slightly as I go. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bash # Set variables for the following NEW_HOSTNAME=**hostname** NAME="**Your Name**" EMAIL=**your@e.mail** ################################################## # Change hostname sudo hostname $NEW_HOSTNAME ################################################## # Enable VNC sudo systemctl enable vncserver-x11-serviced sudo vncpasswd -service # echo "Authentication=VncAuth" >> /etc/vnc/config.d/common.custom sudo systemctl restart vncserver-x11-serviced # You can now connect using the free viewer app at https://www.realvnc.com/en/connect/download/viewer/ # which asks you to create an account and sign in, but allows you to operate without that. ################################################## # Emacs w/ markdown mode sudo apt --yes install emacs echo "'(\"melpa-stable\" . \"https://stable.melpa.org/packages/\")) (package-initialize)" > ~/.emacs emacs --batch --eval "(package-install 'markdown-mode)" ################################################## # git # git config needed for push git config --global user.name "$NAME" git config --global user.email "$EMAIL" git config pull.rebase false # git LFS (do before cloning anything!) sudo apt install git-lfs git lfs install # Password caching git config --global credential.helper store # Easier branch management sudo apt install hub ################################################## # Emoji render correctly in Chromium sudo apt install fonts-noto-color-emoji ################################################## # Log2ram (reduce SD card writes) mkdir tmp pushd tmp wget https://github.com/azlux/log2ram/archive/master.tar.gz -O log2ram.tar.gz tar xf log2ram.tar.gz cd log2ram-master sudo ./install.sh popd rm -rf tmp rm log2ram.tar.gz ################################################## # Add the current directory to the path printf "\nexport PATH=.:\$PATH\n" >> ~/.bashrc ################################################## # Game development tools sudo apt --yes install krita sudo apt --yes install pngcrush sudo apt --yes install tiled sudo apt --yes install audacity ################################################## # Reboot! sudo reboot ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Links - [Disable screen blanking](https://pimylifeup.com/raspberry-pi-disable-screen-blanking/) - [Power requirements](https://github.com/raspberrypi/documentation/blob/develop/documentation/asciidoc/computers/raspberry-pi/power-supplies.adoc) - RPi 3: 5V @ 2.5A = 12.5W - RPi 4: 5V @ 3A = 15W - RPi 5: 5V @ 5A = 25W (27W Recommended, must use USB-PD cable) - [RPi 4 Specs](https://www.raspberrypi.com/products/raspberry-pi-4-model-b/specifications/) - [RPi 5 Specs](https://datasheets.raspberrypi.com/rpi5/raspberry-pi-5-product-brief.pdf)