Quick setup Raspberry Pi Zero W
From time to time I have a need quickly setup Raspbian on Raspberry Pi Zero W.
Here is the quick step by step guide:
In the local computer download an image and upload it to sd card: (replace /dev/sdX, username, wlanname, wlanpassword, 192.168.0.155 with your own values)
# download image
wget https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2021-05-28/2021-05-07-raspios-buster-armhf-lite.zip
# extract
unzup 2021-05-07-raspios-buster-armhf-lite.zip
# copy to device
sudo dd if=2021-05-07-raspios-buster-armhf-lite.img of=/dev/sdX bs=2M conv=fsync
# activate ssh
touch /media/username/boot/ssh
# update the wifi access credentials
cat > /media/username/rootfs/etc/wpa_supplicant/wpa_supplicant.conf << EOF
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=DE
network={
ssid="wlanname"
psk="wlanpassword"
key_mgmt=WPA-PSK
}
EOF
# setup static IP address
cat >> /media/username/rootfs/etc/dhcpcd.conf << EOF
interface wlan0
static ip_address=192.168.0.155/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8
EOF
# prevent warning locale not found
cat >> /media/username/rootfs/etc/environment << EOF
LC_ALL=C
LANG=en
LANGUAGE=en
EOF
Put sd card to device and turn it on.
If everzthing went successful then you will see the new device in the network.
Connect to device by ssh: pi@192.168.0.155, the default password: "raspberry".
# expand filesystem on SD card
sudo raspi-config --expand-rootfs
# reboot
sudo reboot now
# after reboot login again and
# upgrade the system
sudo apt-get update
sudo apt-get upgrade -y
After all steps above you will have a device with Linux to play with.
It is very important to use good card reader. I wasted lots of time before I discovered that my internal card reader does not write sd card well. It reads ok, but when I try to write or format sd cards on it the previously written information appears unchanged. After swithing to exteranal card reader all problems were gone.
The more information you can find on the original Raspberry Pi OS documentation.
разрешены только теги br, font, span, p, strong, u, p, blockquote, a, div, img - остальные будут безжалостно удаляться
комментарии: