Run Relay on Linux
Install and run Viaalink Relay as a systemd service on a dedicated Linux server or VPS.
Overview
This guide explains how to install and configure Viaalink Relay on a Linux server (Ubuntu, Debian, or Rocky Linux) using a systemd service unit.
Prerequisites
- A Linux server running an x86-64 (amd64), ARM64, or 32-bit ARMv6 distribution. The ARMv6 build covers Raspberry Pi Zero and Raspberry Pi 1, and also runs on a 32-bit Raspberry Pi OS on later models.
- Root or
sudoprivileges. - A registered domain name pointing at your server’s IP address (see DNS Configuration).
- Firewall or router rules allowing traffic on ports
2222/tcp,80/tcp,443/tcp, and optionally3478/udp(see Requirements and Network Architecture).
Installation
1. Obtain the binary
Linux release archives (viaalink-relay-1.40.6.linux-amd64.tar.gz, viaalink-relay-1.40.6.linux-arm64.tar.gz, and viaalink-relay-1.40.6.linux-armv6.tar.gz) are publicly available at GitHub releases.
Verify the downloaded archive using the checksums file:
sha256sum --ignore-missing -c viaalink-relay-1.40.6-checksums.txtThe release archive contains the viaalink-relay binary, templates/, and deploy/. The Relay loads templates from disk relative to its working directory. Keep templates/ and deploy/ in the Relay working directory (/var/lib/viaalink-relay as configured in the systemd unit below). Moving only the binary without templates makes it crash at start.
Extract the archive and move the binary to your system PATH:
tar -xzf viaalink-relay-1.40.6.linux-amd64.tar.gz
cd viaalink-relay-1.40.6.linux-amd64
chmod +x viaalink-relay
sudo mv viaalink-relay /usr/local/bin/viaalink-relayVerify that the binary runs:
viaalink-relay --version2. Create the system user and directories
Create a dedicated, unprivileged system user and group to run the Relay:
sudo useradd --system --user-group --no-create-home --shell /usr/sbin/nologin viaalinkCreate persistent directories for server host keys, authorized public keys, TLS certificates, license files, and configuration, and copy templates/ and deploy/ from the extracted archive into the Relay working directory:
sudo mkdir -p /var/lib/viaalink-relay/keys
sudo mkdir -p /var/lib/viaalink-relay/pubkeys
sudo mkdir -p /var/lib/viaalink-relay/ssl
sudo mkdir -p /var/lib/viaalink-relay/license
sudo cp -r templates deploy /var/lib/viaalink-relay/
sudo chown -R viaalink:viaalink /var/lib/viaalink-relay
sudo chmod 700 /var/lib/viaalink-relay/keys3. Create the configuration file
Create an initial configuration file at /var/lib/viaalink-relay/config.yml. License mode is always on in release builds. Setting license-key-file specifies the path to your license file:
domain: relay.example.com
ssh-address: :2222
http-address: :8080
https: true
https-address: :8443
authentication: true
bind-random-subdomains: true
log-json: true
log-to-stdout: true
private-keys-directory: /var/lib/viaalink-relay/keys
authentication-keys-directory: /var/lib/viaalink-relay/pubkeys
https-certificate-directory: /var/lib/viaalink-relay/ssl
license-key-file: /var/lib/viaalink-relay/license/license.jwtNote: Behind a TLS-terminating reverse proxy (such as Caddy on the same machine), run the Relay with
--domain=relay.example.com --http-address=127.0.0.1:8080 --proxy-ssl-termination --trusted-proxies=127.0.0.1. The--https-port-overrideflag is only needed if the proxy does not listen on port443. Router port translation (80 -> 8080,443 -> 8443) without a reverse proxy is a different setup; keephttp-address: :8080andhttps-address: :8443without proxy flags. If the Linux host binds ports80and443directly withAmbientCapabilities=CAP_NET_BIND_SERVICE, sethttp-address: :80,https-address: :443,https: true,https-ondemand-certificate: true,https-ondemand-certificate-accept-terms: true, andhttps-ondemand-certificate-email: admin@example.com.
Set appropriate file ownership:
sudo chown viaalink:viaalink /var/lib/viaalink-relay/config.yml
sudo chmod 600 /var/lib/viaalink-relay/config.ymlSystemd service configuration
The Relay server does not ship with a pre-installed systemd service. Below is an example unit file that configures automatic startup, restart on failure, and file limit tuning.
Create /etc/systemd/system/viaalink-relay.service:
[Unit]
Description=Viaalink Relay Server
After=network.target network-online.target
Wants=network-online.target
[Service]
Type=simple
User=viaalink
Group=viaalink
WorkingDirectory=/var/lib/viaalink-relay
ExecStart=/usr/local/bin/viaalink-relay \
--config=/var/lib/viaalink-relay/config.yml \
--domain=relay.example.com \
--ssh-address=:2222 \
--http-address=:8080 \
--https --https-address=:8443 \
--private-keys-directory=/var/lib/viaalink-relay/keys \
--authentication-keys-directory=/var/lib/viaalink-relay/pubkeys \
--https-certificate-directory=/var/lib/viaalink-relay/ssl \
--license-key-file=/var/lib/viaalink-relay/license/license.jwt \
--log-json=true
Restart=always
RestartSec=5s
LimitNOFILE=65535
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.targetReload the systemd manager configuration, enable the service, and start it:
sudo systemctl daemon-reload
sudo systemctl enable --now viaalink-relay.serviceFirst start and setup page
On first boot, the Relay generates an initial setup code, writes it to /var/lib/viaalink-relay/license/setup-token.txt, and logs it to the systemd journal (Setup dashboard token: <setup-code>).
Inspect the service logs using journalctl or read setup-token.txt to retrieve your setup code:
sudo journalctl -u viaalink-relay.service -n 50 --no-pager
sudo cat /var/lib/viaalink-relay/license/setup-token.txtOpen the browser setup interface over HTTPS (when TLS is configured on your domain):
https://relay.example.com/_relay/dashboard?x-authorization=<setup-code>Or connect directly to the HTTP listener on port 8080:
http://<server-ip>:8080/_relay/dashboard?x-authorization=<setup-code>After the first visit with ?x-authorization=<setup-code>, the browser stores your session cookie and subsequent visits to /_relay/dashboard open directly. From the setup dashboard, you can:
- Activate a license (from your browser, with an activation code, or by uploading a license file) or operate under the Free plan (3 connected devices (up to 10 connections)).
- Add custom domains and choose TLS validation methods.
- Authorize connecting client devices by adding public keys.
The dashboard described here is in Relay v1.36.0 and later, and in the ASUSTOR package 0.62.7 and later.
Settings saved in /_relay/dashboard that need a restart cause the Relay to stop itself after a short delay, relying on systemd (Restart=always) to bring it back. Flags in the systemd unit (--domain, --ssh-address, --http-address, --https-address, and so on) override config.yml, so a domain or port changed in the dashboard is written to config.yml but ignored after the restart. Keep those settings in config.yml and remove the flags from the unit. In Relay v1.36.0 and later, and in the ASUSTOR package 0.62.7 and later, settings changes that need a restart show a restart bar with options: Restart now, Tonight at …, or Undo.
Verifying server health
Viaalink Relay does not expose a plain HTTP health URL. Server operational health is confirmed when:
- The SSH listener on port
2222responds to connection attempts:bashnc -zv 127.0.0.1 2222 - The browser setup dashboard loads at
http://<server-ip>:8080/_relay/dashboardorhttps://relay.example.com/_relay/dashboard.
Next steps
- Review Access Control and Security to authorize client keys and configure IP rules.
- Review Relay Configuration Reference for all available runtime flags.
- Install the developer CLI by following Install the Viaalink CLI.