Linux Installation - NoobishSVK/fm-dx-webserver GitHub Wiki

FM-DX Webserver Linux Installation

In this guide, we will install FM-DX Webserver.

This installation is demonstrated on Debian 12 (Bookworm) but should work on most Debian-derived distributions. We assume you have a fresh installation and a user named fmdx with sudo permissions.

Note: The Node.js version provided by your OS might be too old. If you run into issues, please install the latest Node.js from https://nodejs.org/en/download.

You will need a Linux-supported (USB) audio device and a tuner supported by FM-DX Webserver.
By default, this guide assumes your tuner is on /dev/ttyUSB0. For headless units, use /dev/ttyACM0.

There are three ways to connect your TEF radio for data communication:

  1. Direct: The serial connection is managed by the fm-dx-webserver.
  2. Remote: You connect the fm-dx-server to a network-enabled TEF radio.
  3. Xdrd: You run xdrd on your local host system and connect to it via localhost networking.

Note: If you plan to use Direct or Remote, you can skip installing xdrd. However, you still need to add your user to the dialout group when using Direct, See the xdrd installation section below for more details.


Login to Your Target System

ssh fmdx@server
fmdx@server:~$ mkdir build
fmdx@server:~$ cd build

Install Required Tools for Building

sudo apt install -y git build-essential libssl-dev pkgconf

Installation of xdrd

If you do not need to use xdrd locally (i.e., you plan to use Direct or Remote instead), you can skip this section. If you do install xdrd, make sure to add your user to the dialout group (see below).

git clone https://github.com/kkonradpl/xdrd.git

Building xdrd

cd xdrd
make

Installing xdrd

sudo make install

Starting xdrd

Before running xdrd, ensure your user can use serial ports by adding the user to the dialout group:

sudo adduser "$(whoami)" dialout

To apply the group change immediately (without logging out and back in), run:

newgrp dialout

Creating the xdrd Service File

To have xdrd start on boot, create the following systemd service file.

Create /etc/systemd/system/xdrd.service:

  • Using vi:
    sudo vi /etc/systemd/system/xdrd.service
    
  • Using nano:
    sudo nano /etc/systemd/system/xdrd.service
    

Insert the following content (adjust the serial port -s option if needed, for example /dev/ttyUSB1 or a /dev/serial/by-id/... device):

[Unit]
Description=xdrd
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/usr/bin/xdrd -p password
User=fmdx
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=xdrd

[Install]
WantedBy=multi-user.target

Enable and start the xdrd service:

sudo chmod 644 /etc/systemd/system/xdrd.service
sudo systemctl daemon-reload
sudo systemctl start xdrd
sudo systemctl enable xdrd

Verify xdrd is Running

systemctl status xdrd
● xdrd.service - xdrd
     Loaded: loaded (/etc/systemd/system/xdrd.service; enabled; preset: enabled)
     Active: active (running) since Mon 2025-02-10 19:18:35 CET; 8s ago
   Main PID: 2061 (xdrd)
      Tasks: 2 (limit: 8717)
     Memory: 632.0K
        CPU: 4ms
     CGroup: /system.slice/xdrd.service
             └─2061 /usr/bin/xdrd -p password

Test xdrd by connecting to your machine with xdr-gtk.


Installation of FM-DX Webserver

Checking Out the Source Code

cd ../../
pwd

You should now be in /home/fmdx.

git clone https://github.com/NoobishSVK/fm-dx-webserver.git

Satisfying Runtime Requirements for FM-DX Webserver

cd fm-dx-webserver
sudo apt install -y ffmpeg nodejs npm
npm install

Starting FM-DX Webserver to Verify Runtime Requirements

node .
[09:04] [INFO] Web server is running at http://0.0.0.0:8080.
[09:04] [INFO] Connection to xdrd established successfully.
[09:04] [INFO] An existing installation of ffmpeg found, enabling audio stream.
[09:04] [INFO] Launching audio stream on port 8081.
[09:04] [INFO] Authentication with xdrd successful.

Check http://your-server:8080 in your web browser to verify the FM-DX Webserver interface.

If everything works, press Ctrl+C to stop the process.


Configuring the Audio Device for Audio Streaming

Add your user to the audio group so it can access audio devices:

sudo adduser "$(whoami)" audio

To apply the group change immediately without logging out:

newgrp audio

Note: A reboot might be necessary in some cases.

Test startup again:

node .
[09:18] [INFO] Web server is running at http://0.0.0.0:8080.
[09:18] [INFO] Connection to xdrd established successfully.
[09:18] [INFO] An existing installation of ffmpeg found, enabling audio stream.
[09:18] [INFO] Launching audio stream on port 8081.
[09:18] [INFO] Authentication with xdrd successful.
[09:19] [INFO] Web client connected (192.168.123.123) [1]

Press Ctrl+C to stop.


Creating the Service File for FM-DX Webserver

To have FM-DX Webserver start on boot, create the following service file.

Create /etc/systemd/system/fm-dx-webserver.service:

  • Using vi:
    sudo vi /etc/systemd/system/fm-dx-webserver.service
    
  • Using nano:
    sudo nano /etc/systemd/system/fm-dx-webserver.service
    

Insert the following content:

[Unit]
Description=FM-DX Webserver
After=network-online.target xdrd.service
Requires=xdrd.service

[Service]
ExecStart=npm run webserver
WorkingDirectory=/home/fmdx/fm-dx-webserver
User=fmdx
Restart=always

[Install]
WantedBy=multi-user.target

Enable and start the FM-DX Webserver service:

sudo chmod 644 /etc/systemd/system/fm-dx-webserver.service
sudo systemctl daemon-reload
sudo systemctl start fm-dx-webserver
sudo systemctl enable fm-dx-webserver

Upgrading FM-DX Webserver

Before upgrading, consider backing up your current fm-dx-webserver directory.

cd fm-dx-webserver
git pull

Restart the FM-DX Webserver:

sudo systemctl restart fm-dx-webserver