Setup SD Card on another linux machine to install headless
I use Desktop Raspberry Pi OS distro. This is tested on a Pi Zero and a Pi 4 in Feb 2020.
Insert a new SD card (e.g. /dev/sdc/). The check the install script or wget and run it:
wget https://gist.githubusercontent.com/brettbeeson/62fa0298667e5bdb2eeb87d768ecc57a/raw/9d30fcbc29e6812dc80a1c2364cbd691a7a605e1/write-pi-sd.sh
chmod write-pi-sd.sh
./write-pi-sh /dev/sdc
Login and configure
Firstly interactively configure:
# first run - interactive
passwd
sudo dpkg-reconfigure tzdata
sudo raspi-config nonint do_hostname YOUR_HOSTNAME
sudo reboot
Then after reboot run this raspi-config-auto.sh
wget -O raspi-config-auto.sh https://gist.githubusercontent.com/brettbeeson/45faf0a8248ec805a2f0da7b6bf671f0/raw/raspi-config-auto.sh
chmod 755 raspi-config-auto.sh
./raspi-config-auto.sh
Make an Access Point
- RaspAP makes access and WiFi easier but for PiZero I use this script as it’s reliable. See details.
Other stuff
- Samba is easy to install to get file sharing. See various tutorials. Might have to open the firewall:
# install
sudo apt install smb
# configure
sudo vim /etc/samba/smb.conf
[share]
path = /var/path/
read only = yes
public = yes
writable = no
# and restart
sudo systemctl restart smbd
# ufw firewall
sudo ufw allow proto udp to any port 137 from 192.168.0.0/24
sudo ufw allow proto udp to any port 138 from 192.168.0.0/24
sudo ufw allow proto tcp to any port 139 from 192.168.0.0/24
sudo ufw allow proto tcp to any port 445 from 192.168.0.0/24
- mDNS / Bonjour is a bit of a pain. I hacked through various changes. Try the following in order
- Pray
- In HyperV, use a “External Network” to let the VM connect to your real LAN. The default is a VM-Host network with the Host acting as a Nat Gateway
- In Windows disable IPv6 (via adapter settings)
- In Windows install Bonjour V2.
- Maybe? fuck ’round with avahi-daemon.conf on the linux side (no ipv6, etc).
- Maybe? install Samba
- Maybe? add wins to /etc/nsswitch.conf
One thought on “Raspberry Pi Setup (Linux)”