There are many guides on setting up a Raspberry Pi. Over the years, I have used several different set up tutorials, and they tend to change over time.
The parts below perform best in my applications. These parts are more expensive than contained in the usual starter kit.
Get parts and tools (prices in USD):
I have used these steps with:
Raspberry Pi Zero H (or W)
Raspberry Pi 3 Model B+ Newark Element14 $35
Miuzei Case for Raspberry Pi 3B+ with cooling fan and 3× Heatsinks, 5V 2.5A Power Supply, USB Cable with On/Off Switch for RPi 3b+ 3b 2b Amazon $16.09
Raspberry Pi 4
Raspberry Pi 4 B
I have used 8GB to 64GB Class 10 microSD cards. For example
SanDisk Ultra 16 GB microSDHC Class 10 with Adapter (SDSQUAN-016G-G4A) from Amazon $8.99
The size of the microSD card depends on the application. I generally use SanDisk and Class 10 and 16GB.
Most Raspberry Pi problems are caused by poor power supplies. I try to use either high quality supplies (i.e., not CanaKit) or ones that are rated at 5.2V and 2.1amps for 3B+. If the voltage drops below 4.75V 3B+, then the Raspberry Pi CPU will behave erratically. USB peripherals, add-on boards and CPU intensive applications will also drive voltage use. The RPi requires a different power supply and connector.
The Miuzei case might be overkill but it comes with a fan, a good power supply and appropriate heat sinks. Well, and the case is pretty cool.
Reusable parts:
USB microSD Card reader - this is a must
MacBook (or PC)
[Optional] Wireless keyboard and mouse
[Optional] TV with HDMI port
Step 1. Burn Raspberry Pi OS (aka raspbian) on a microSD card
Insert the microSD Card in the Raspberry Pi
To complete the steps in the link, you need:
♣your-wifi-password♣
♣your-wifi-ssid♣
Step 2. Attach the heat sinks
You should have three heat sinks. The heat sink and appropriate chip should be almost the same size. Two go on top of the board, and the flat copper one goes on the bottom chip. For each heat sink, remove the tape and press firmly on to the appropriate chip.
Step 3. Set up the Raspberry Pi
With the power off
Insert micro SD Card in Raspberry Pi
If running headless, the following items should be skipped, otherwise insert these into the Raspberry Pi:
Ethernet cable
HDMI Cable
Keyboard & Mouse (or wireless mouse & keyboard dongle)
Once the above are complete:
Insert power cable
Step 4. if a monitor is connected and using Raspberry Pi OS, otherwise go to the next step
If a Monitor is connected and using Raspberry Pi OS, then the Welcome app starts on boot
Follow the directions and setup the Raspberry Pi
Step 5. Configure advanced raspbian options using raspi-config
If a monitor is not connected, then use Open a terminal window and login.
raspi-config is a menu driven shell script. To navigate through the menus, here are some things to know:
Use up and down arrows to move through the menu
Use Tab from the menu to one of the options contained in angle brackets, such as, <finish>
Use Enter to execute the option selected
* indicates an item is selected
Use the spacebar to toggle * on and off
When the Raspberry Pi reboots after Step 5, open a terminal window, login and run the command:
$ sudo raspi-config
There are lots of options in raspi-config. It is worthwhile to go through the options and see what is available. Here are the ones I always change:
1 System Options
S3 Password
♣raspberry-pi-password♣
S4 Hostname
♣hostname♣
5 Localisation Options
L1 Locale
[*] en_GB.UTF-8 UTF-8
[*] en_US.UTF-8 UTF-8
en_US.UTF-8
L2 Timezone
US
Central
L3 Keyboard
6 Advanced Options
A1 Expand Filesystem
Finish and reboot
Step 6. Put the Raspberry Pi in a Case [optional]
Step 7. Run Automated Setup Script [optional]
Warning: Retropie runs on an old version of the Raspberry Pie OS. Do not run this script if you are doing Retropie install.
Open a terminal window and login
The automated script does the following:
Updates, upgrades and autoremoves packages
Removes unused packages
Removes desktop packages
Disables IPv6
Improve security
Install uncomplicated firewall (ufw)
Install fail2ban
Lessen denial of service attacks
Prevent IP Spoofing
Harden sysctl configuration settings
Install logwatch
Install rootkit Checker
Install rpi-monitor
Reboots
Get the script:
$ wget "https://raw.githubusercontent.com/dumbo25/unsed_rpi/main/rpi_setup.sh"
$ wget "https://raw.githubusercontent.com/dumbo25/unsed_rpi/main/rpi_setup.cfg"
Edit the .cfg file to meet your needs (e.g., enter your SSID password)
See the help on the script and its options. Most of the items listed above can be controlled by an option.
$ sudo bash rpi_setup.sh -h
Run the script with the options selected. Since there are points that require a reboot, running the script will need to be done multiple times until you get a Success! message
$ sudo bash rpi_setup.sh
And you are done!
Troubleshooting
You should not have any issues, but if you do start with R-Pi Troubleshooting.
If the Raspberry Pi is having issues just installing, then in my experience either 1) microSD card needs to be reflashed, or 2) there is something wrong with the display or its settings or its connections.
The website above will lead you through diagnosing and fixing.
If you receive this message:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:HwCVPtpeot4ZyxQj8XFNONZPMdUkWt1ssFMTgDZsnLE.
Please contact your system administrator.
Add correct host key in /Users/username/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/username/.ssh/known_hosts:21
ECDSA host key for 192.168.0.227 has changed and you have requested strict checking.
Host key verification failed.
The run this command:
$ sudo nano /Users/username/.ssh/known_hosts
go to the offending line, in this case it is 21. Hit CTRL-k, which deletes the line
Then CTRL-o and CTRL-x to write and exit the editor
References:
My Analysis: Raspberry Pi Micro SD Cards
raspberrypi.org: SD Card Benchmarks
elinux.org: micro SD Card benchmarks
elinux.org: Raspberry Pi micro SD card guidelines
elinux.org: Raspberry Pi compatible micro SD Cards
raspberrypi.org: Installing images
adafruit.com: Preparing a microSD Card for a Raspberry Pi