Setup Raspberry Pi Zero W (or WH)
Step 1. Burn raspbian on a microSD card
Insert the microSD Card in the Raspberry Pi
After this step, you have an ssh and Wi-Fi enabled MicroSD Card
Step 2. Attach a heat sink
You should have one heat sink for the Raspberry Pi Zero CPU.
Do not use the extremely low profile heat sink (Raspberry Pi logo, gold-like finish, flat with no fins). It does not significantly lower CPU temperature
Add a low-profile heat sink with fins. Remove the heat sink's tape and press firmly on to the CPU.
Step 3. Set up the Raspberry Pi Zero
With the power off
Insert micro SD Card in Raspberry Pi
The Raspberry Pi Zero runs headless. So, there is no HDMI Cable, Keyboard, Mouse or Ethernet cable.
Once the above are complete:
Insert power cable
Step 4. Open a Terminal Window and Login
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 - use Raspberry Pi Imager Advancced Settings
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
Open a terminal window and login using the new hostname and password
$ ssh pi@♣hostname♣
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)
$ nano rpi_setup.cfg
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. You will need log back in after each reboot.
$ sudo bash rpi_setup.sh
And you are done!