- Download the latest version of Raspberry Pi OS
- with the caveat that there was a change to camera utility between buster and bullseye.
- This was tested on an older Buster image
- Download the Imager and use it to impact the downloaded zip's
.imgonto the MicroSD touch sshin thebootdrive's/, to enable one-time ssh if headlessssh -vvv pi@raspberrypi.localwhen connected by ethernet and powered on. (Which includes approving the ECDSA fingerprint)- Enable the ssh server perpetually, rather than the one-time start up.
sudo raspi-config, selectInterface Options, then selectSSH, then confirm withYes,OK,Finish
- Change the password. The default user
piwith passwordraspberrycan be replaced. Instructions copied from the pi tutorial are (for the example useralice);sudo adduser alicesudo usermod -a -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi alicesudo su - aliceto check the sudo group was applied (which might just warn that WiFi is not yet enabled.)sudo raspi-config, selectSystem Options, thenBoot / Auto LoginConsole Autologinto change frompitoalice- OR
Consoleto require a password - (which will trigger a request to reboot, that you should accept).
- because some RPi's require the
piuser, rather than delete, justpasswdto change. - To make sudo require a password every time on the
piuser;sudo visudo /etc/sudoers.d/010_pi-nopasswd(which will open nano. gross)- swap
pi ALL=(ALL) NOPASSWD: ALLtopi ALL=(ALL) PASSWD: ALL(Ctrl+O and write to the *.tmp file, then Ctrl+X to exit) - There is not one by default made for the new user, and the default behaviour is
PASSWD: ALLanyway.
- There's plenty more security considerations available, but not relevant immediately during an example setup.
- Add the wifi network to
wpa_supplicant.confandsudo reboot- This can either be done after imaging the MicroSD, before loading the first time, or can be edited in the file
/etc/wpa_supplicant/wpa_supplicant.conf, or done withraspi-config - To directly edit the file, use
sudo iwlist wlan0 scanto get the *ssid of networks available and add the WPA/WPA2 network you want.- It's possible
sudo iwlist wlan0 scanwill yieldwlan0 Interface doesn't support scanning : Network is down - In which case, use
sudo ifconfig wlan0 up, and perhaps getSIOCSIFFLAGS: Operation not possible due to RF-kill - If so,
sudo rfkill listwill show that Wireless LAN is soft blocked. Unblock it withsudo rfkill unblock wifi - Scanning again should automatically start and yield a list of cells.
- Look for the cell with the ESSID you want to join, and confirm its "IE: IEEE 802.11i/*" is of WPA/WPA2, and provides PSK in "Authentication Suites"
- It's possible
- While we could just enter the password raw, it's better to use
wpa_passphraseto generate an encryptedpskwpa_passphrase "*ssid", then enter the password. This'll give you the encrypted PSK- Open wpa_supplicant
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf, copy the output ofwpa_passphrase ~and remove the unencrypted password.
- Also set the country code, by adding a
country=<country_code>line inwpa_supplicant.conf - It should now look something like;
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=AU network={ ssid="Some_Network_Name" psk=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef } - Once finished editing,
wpa_cli -i wlan0 reconfigureto immediately pick up the changes, thenifconfig wlan0to check, and see aninetaddress.
- This can either be done after imaging the MicroSD, before loading the first time, or can be edited in the file
- You should now be able to disconnect from ethernet and connect over WiFi, assuming you've set up on the same network
ssh -vvv <pi|alice>@raspberrypi.localshould continue to work locally without having changed the hostname in raspi-config, or alternatively use the local IP if ssh'ing from windows.
- Update ~
sudo apt update && apt upgrade && apt dist-upgrade- Depending on your release version, might get a warning about deprecation of
NPAPIfromwebkit2gtkafter the upgrade has completed. - Install a good, non-nano, editor;
sudo apt install vim - Install all the good things
sudo apt install build-essential pip install --upgrade pipandpip3 install --upgrade pip
- Depending on your release version, might get a warning about deprecation of
- Setup remote client (VNC installed by default, but must be enabled with
raspi-config) as well as installing the remote server locally. Make sure you've picked a reasonable default HDMI/DVI, as this impacts the resolution of VNC.sudo raspi-config, selectInterface Options, then selectVNC, then confirm withYes,OK,Finish- Connect from the VNC Viewer locally, and start the GUI from cli with
sudo startx - On the first connection, it'll ask you to set your country, language, and timezone.
- It will also run through some of the other "first time startup" questions that have already been handled by the above and can be ignored.
- If you'd like to connect with VNC without SSH in the future, got back into
Boot / Auto Loginand set it toDesktop Autologin - To change the resolution in headless mode, in
sudo raspi-config, go toDisplay Options,Resolution, and select an appropriate resolution, and accept the reboot.
Created
March 5, 2022 11:46
-
-
Save Skenvy/4bc687b4efb1170aa0c01ff5c3e7ca72 to your computer and use it in GitHub Desktop.
Initial Headless Setup with RPi3B+ OS (Buster)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment