Raspberry Pi Zero W: Overview, System Installation, and Basic Configuration
This article introduces the Raspberry Pi Zero W hardware, explains how to download and flash a Raspbian Lite image onto a micro‑SD card, configures SSH and Wi‑Fi, optimizes the system, installs nginx, and demonstrates basic network‑exposure techniques such as ngrok for remote access.
Raspberry Pi Overview
Raspberry Pi (RPi) is a credit‑card‑sized Linux‑based single‑board computer designed for learning programming and hardware projects. The Zero W model is a miniature version, roughly one‑third the size of a Pi 3 B+, featuring a 1 GHz BCM2835 CPU, 512 MB RAM, Wi‑Fi/Bluetooth, and a range of I/O ports.
Key Specifications of Zero W
BCM2835 processor, 1 GHz, 512 MB RAM
BCM43438 Wi‑Fi / BT chip
Micro‑USB power and OTG ports
Mini‑HDMI output
CSI camera connector
40‑pin GPIO header
Micro‑SD slot for the OS
Dimensions: 65 mm × 30 mm
Preparing the System Image
Download the official Raspbian Stretch Lite image (a lightweight, console‑only distribution) and extract the .img file from the zip archive.
Required Materials
16 GB or 32 GB SanDisk micro‑SD card
Standard USB‑type‑A data cable (not USB‑C)
SD card formatting tool (e.g., SDFormatter)
Win32DiskImager (or similar flashing utility)
Raspbian image file
Flashing the Image
sudo nano /etc/apt/sources.list
# comment existing lines and add:
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/raspbian stretch main contrib non-free rpiInsert the micro‑SD card into a reader, open Win32DiskImager, select the .img file, choose the correct device, and click “Write”.
Boot Partition Configuration
After flashing, the card shows a single boot partition (≈40 MB). Create two empty files in this partition:
ssh – enables SSH on first boot (no extension, no content)
wpa_supplicant.conf – contains Wi‑Fi credentials: country=CN ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="YOUR_WIFI_SSID" psk="YOUR_WIFI_PASSWORD" }
First Boot and Basic Setup
Insert the card into the Zero W, power it via a 5 V 1 A USB cable, and wait for the LED to become steady. Locate the device’s IP address on your router (e.g., 192.168.0.104) and SSH into it using the default credentials pi / raspberry .
System Optimization
Replace default apt sources with a domestic mirror (e.g., USTC) by editing /etc/apt/sources.list and /etc/apt/sources.list.d/raspi.list , then run sudo apt-get update && sudo apt-get upgrade .
Set the timezone with sudo dpkg-reconfigure tzdata (select Asia → Shanghai).
Enable SSH on boot via sudo raspi-config (Interfacing Options → SSH) or by adding /etc/init.d/ssh start before exit 0 in /etc/rc.local .
Installing Nginx
# Install
sudo apt-get install nginx
# Start
sudo /etc/init.d/nginx start
# Restart
sudo /etc/init.d/nginx restart
# Stop
sudo /etc/init.d/nginx stopAccess http:// your_pi_ip in a browser to verify the Nginx welcome page.
Exposing the Service to the Internet
To make the web server reachable from outside the local network, use a tunneling service such as ngrok, frp, or domestic alternatives (ittun, sunny, natapp). The article demonstrates using the ngrok_arm client on Zero W and running it inside a screen session.
Sample ngrok Configuration
./ngrok http 80After starting ngrok, a public URL (e.g., http://zerow.ittun.com/ ) forwards traffic to the Pi’s Nginx server.
Conclusion
The Raspberry Pi Zero W, despite its modest CPU and memory, can comfortably host a lightweight web service, run SSH, and be accessed remotely via tunneling. The setup described provides a solid foundation for further IoT or hobby projects.
Architecture Digest
Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.