gSender headless setup with Pi 4 guide

This guide will walk you through setting up gSender on a Raspberry Pi without the need to connect a keyboard or display (headless setup). You will perform all interactions remotely using SSH.

gSender requires a full desktop environment, so we’ll use the full Raspberry Pi OS with Desktop, not the Lite version.

Prerequisites

  • Raspberry Pi 4 or later
  • Raspberry Pi OS (64 Bit) installed on an SD card
  • ssh client
  • Internet connection
  • Basic knowledge of Linux commands
  • VNC Client for remote desktop access such as RealVNC (Optional)

Step 1: Install Raspberry Pi OS (64-bit) with Desktop

  • Download and install the Raspberry Pi Imager from the official Raspberry Pi website if you haven’t already.
  • Open Raspberry Pi Imager, select Raspberry Pi OS (64-bit) as the operating system.
  • Choose your SD card as the storage location and click Next.

image

  • After selecting Next, you will be presented with the option to customize settings. Click EDIT SETTINGS.
    • On the General tab, make the following changes:
      • Hostname: Change the hostname to onefinity (or any name you prefer).
      • Username: Set to pi.
      • Password: Set to gsender (you can change this to any secure password you desire).
      • Wireless Network: Enter your Wi-Fi network SSID and password.
    • Go to the Services tab:
      • Enable SSH: Make sure to check the box to enable SSH, allowing remote access.
    • Leave the rest of the options as default and click SAVE.
  • Click Yes to apply the custom settings and Yes again proceed with flashing the SD card.
  • After the flashing is complete, remove the SD card from your computer, insert it into your Raspberry Pi, and power it on. Give it 2 to 5 minutes to initialize the OS before proceeding to the next step.

Step 2: Install gSender, enable Remote Access and set auto-start.

  • ssh to the Rasberry pi. Password is gsender or the password you enter from Step 1.

    ssh pi@onefinity.local
    
  • Execute the following commands.

    # Set gSender version to install. 
    APP_VERSION=1.4.9
    
    # Download gSender
    cd ~/Downloads
    curl -LO https://github.com/Sienci-Labs/gsender/releases/download/v$APP_VERSION/gSender-$APP_VERSION-PI-64Bit.deb
    
    # Install gSender
    sudo dpkg -i gSender-$APP_VERSION-PI-64Bit.deb
    
    # Enable gSender Remote Access for headless setup. Note: there should be no space before `>` else it will create CRLF issue. 
    echo "{ \"remoteSettings\": { \"ip\": \"$(hostname -I | awk '{print $1}')\", \"port\": 8000, \"headlessStatus\": true }}"> ~/.sender_rc
    
    # Generate autostart, Note: there should be no space before `>` else it will create CRLF issue. 
    mkdir ~/.config/autostart
    echo -e "[Desktop Entry]\nType=Application\nName=gSender\nExec=/opt/gSender/gsender"> ~/.config/autostart/gSender.desktop
    
    # Turn Rasberry PI AutoLogin 
    sudo sed -i 's/^#\?\(autologin-user=\).*/\1pi/; s/^#\?\(autologin-user-timeout=\).*/\10/; s/^#\?\(user-session=\).*/\1PIXEL/' /etc/lightdm/lightdm.conf
    
    sudo reboot
    

That’s it. From here, you can simply use a browser from any device on your network, such as your laptop or tablet, to access the URL http://onefinity.local:8000 .

Step 3: (Optional) Install VNC Server and update all packages

These are optional and not required. I only use this for remote login to Raspberry PI desktop and do some troubleshooting. Also updating packages incase there some security updates.

  • ssh to the Rasberry pi. Password is gsender or the password you enter from Step 1.

    ssh pi@onefinity.local
    
  • Then execute the following commands:

    # (Optional) Enable VNC Server. Useful for troubleshooting.
    sudo systemctl enable wayvnc.service --now
    sudo systemctl start wayvnc.service
    
    # (Optional) Update packages
    sudo apt update && sudo apt upgrade -y
    
2 Likes