Raspi Headless
Fri, Feb 5, 2021
One-minute read
Install Raspbian. Install the desktop version but not the full one.
Enable SSH, autologin and password change:
sudo raspi-config
Install via apt:
sudo apt install vim x11-xserver-utils chromium-browser openvpn
Copy the VPN conf to /etc/openvpn/ and restart for it to take effect.
Change the startup:
vim /etc/xdg/lxsession/LXDE-pi/autostart
(it used to be in /etc/xdg/lxsession/LXDE/autostart)
@xset -dpms
@xset s noblank
@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium/Default/Preferences
@chromium-browser --user-agent='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36' --kiosk --disable-infobars --disable-session-crashed-bubble https://web.whatsapp.com
The user agent is added so that WhatsApp Web doesn’t ask you to update Chrome.
Modify /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="ssidname"
psk="****"
}
Enable WiFi.
Install nvm via curl. Then install node
nvm install node
nvm
Install pm2
npm install pm2@latest -g
Prepare pm2 for startup.
pm2 startup
Execute the script it shows us to prepare the apps at startup.
Then we run our app and save it so it remains at startup.
pm2 start start.sh
pm2 save