Fundamentals 12 min read

How to Set Up Raspberry Pi Zero W: From OS Installation to Remote Access

This guide walks you through understanding what a Raspberry Pi is, the specifications of the Zero W model, preparing the SD card, flashing Raspbian, configuring SSH and Wi‑Fi, optimizing the system, installing Nginx, and exposing the device to the Internet with ngrok.

Java Backend Technology
Java Backend Technology
Java Backend Technology
How to Set Up Raspberry Pi Zero W: From OS Installation to Remote Access

What is Raspberry Pi?

Raspberry Pi (RPi) is a credit‑card‑sized Linux‑based micro‑computer designed for learning programming. It is small but powerful, supporting video, audio, GPIO, and many other functions.

My interpretation

It behaves like a tiny PC that can connect a monitor, keyboard, mouse, USB drives, and provides many serial and peripheral interfaces.

Available models

The most common is the 3‑generation B+ model; the author found a cheaper 100‑CNY variant.

Raspberry Pi Zero W

The Zero W is a mini version, about one‑third the size of a 3B+. It includes Wi‑Fi, Bluetooth, and a very small form factor.

Key specifications:

BCM2835 1 GHz CPU, 512 MB RAM

BCM43438 Wi‑Fi/BT chip

Micro‑USB power and OTG ports

Mini‑HDMI port

Composite video and reset header

CSI camera connector

Micro‑SD slot for the OS

40‑pin GPIO header

Size 65 mm × 30 mm

Despite a single‑core CPU and limited RAM, it can run a small website.

Installing the OS on Zero W

1. Preparation

16 GB or 32 GB micro‑SD card

Standard USB‑A cable (not Type‑C)

SDFormatter

Win32DiskImager

Raspbian Stretch Lite image (or desktop version)

2. Download the image

Download the official Raspbian image, unzip the ~360 MB zip to obtain a .img file (about 1.7 GB).

3. Write the image

Insert the SD card into a reader, open Win32DiskImager, select the .img file, choose the device, and click Write.

4. Configure the boot partition

4.1 Create an empty file named ssh

This enables SSH on first boot.

4.2 Create wpa_supplicant.conf

country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="your_wifi_name"
    psk="your_wifi_password"
}

5. Assemble and power up

Insert the card, connect power via a USB cable, wait for the LED to become steady, then find the Pi’s IP address on the router.

SSH into the Pi (default user pi, password raspberry).

6. System optimization

6.1 Change apt sources to a domestic mirror

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 rpi
sudo nano /etc/apt/sources.list.d/raspi.list
# comment existing lines and add:
deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian stretch main ui
sudo apt-get update
sudo apt-get upgrade

6.2 Set timezone

sudo dpkg-reconfigure tzdata
# choose Asia → Shanghai

6.3 Enable SSH on boot

Method 1: sudo raspi-config → Interfacing Options → SSH → Enable.

Method 2: add /etc/init.d/ssh start before exit 0 in /etc/rc.local.

7. Install 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 stop

Browse to the Pi’s IP address to see the Nginx welcome page.

8. Expose the service to the Internet

Use a tunneling tool such as ngrok or frp. The author uses the ittun ngrok_arm binary to expose http://zerow.ittun.com/.

Running ngrok in a screen session keeps it alive, but auto‑start on reboot is not yet solved.

9. Further possibilities

The Pi can run many other projects; see the Raspberry Pi Lab for more tutorials.

Current status: Nginx and ngrok running, about 250 MB free RAM, CPU temperature 37‑39 °C after two days of operation.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxNginxIoTRaspberry PiSSHngrokZero W
Java Backend Technology
Written by

Java Backend Technology

Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.