Skip to content
Stand with Ukraine flag

Installing Trendz Analytics on Ubuntu Server

This guide explains how to install Trendz Analytics on Ubuntu 22.04 LTS or Ubuntu 24.04 LTS.

Hardware: Minimum 4 GB of RAM and 2 CPU cores. In small and medium deployments, Trendz can be installed on the same server as ThingsBoard.

Software:

Terminal window
sudo apt update && sudo apt install openjdk-17-jdk-headless

Set Java 17 as the default version:

Terminal window
sudo update-alternatives --config java

Verify the installation:

Terminal window
java -version

Expected output:

openjdk version "17.x.xx"
OpenJDK Runtime Environment (...)
OpenJDK 64-Bit Server VM (...)

Download the installation package:

Terminal window
wget https://dist.thingsboard.io/trendz-1.15.1.deb

Install Trendz Analytics as a service:

Terminal window
sudo dpkg -i trendz-1.15.1.deb

Trendz uses PostgreSQL. You can install it on the same server or use a managed PostgreSQL service.

Install PostgreSQL 16:

Terminal window
sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
sudo apt update
sudo apt -y install postgresql-16
sudo service postgresql start

Set a password for the postgres user:

Terminal window
sudo -u postgres psql -c "\password"

Enter and confirm the password when prompted.

Create the Trendz database:

Terminal window
psql -U postgres -d postgres -h 127.0.0.1 -W
CREATE DATABASE trendz;

Press Ctrl+D twice to exit.

Configure the database connection:

Terminal window
sudo nano /etc/trendz/conf/trendz.conf

Add the following lines. Replace PUT_YOUR_POSTGRESQL_PASSWORD_HERE with your actual password:

Terminal window
# DB Configuration
export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/trendz
export SPRING_DATASOURCE_USERNAME=postgres
export SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HERE
Terminal window
sudo /usr/share/trendz/bin/install/install.sh
Terminal window
sudo service trendz start

Log in to ThingsBoard as a Sysadmin and open the Trendz Settings page.

If you see “Synchronization completed successfully”, no further action is needed.

If you see an error message:

  1. Make sure Trendz is running.
  2. Enter the correct Trendz internal URL (must be reachable from ThingsBoard).
  3. Enter the correct ThingsBoard internal URL (must be reachable from Trendz).
  4. Click Save configuration.
  5. Click Retry discovery.

To use Python Calculation Fields and Prediction Models, install the Trendz Python Executor.

See the Python Executor Setup guide for instructions.

Access Trendz UI at http://localhost:8888.

Trendz uses ThingsBoard as its authentication provider — log in with your Tenant Administrator credentials from ThingsBoard.

After the first login, discover the topology so Trendz can learn about your assets, devices, profiles, and relations:

See Business Entities for more on how Trendz uses this topology.

You can configure HTTPS access using HAProxy when Trendz is hosted in the cloud with a valid DNS name.

If HAProxy and Let’s Encrypt are already set up for ThingsBoard, open the HAProxy configuration file:

Terminal window
sudo nano /etc/haproxy/haproxy.cfg

In the frontend https_in section, add an ACL rule and backend reference:

Terminal window
acl trendz_http hdr(host) -i new-trendz-domain.com
use_backend tb-trendz if trendz_http

Register the Trendz backend:

Terminal window
backend tb-trendz
balance leastconn
option tcp-check
option log-health-checks
server tbTrendz1 127.0.0.1:8888 check inter 5s
http-request set-header X-Forwarded-Port %[dst_port]

Generate an SSL certificate:

Terminal window
sudo certbot-certonly --domain new-trendz-domain.com --email [email protected]

Reload HAProxy:

Terminal window
sudo haproxy-refresh

Trendz is now available at https://new-trendz-domain.com.

See the HAProxy on Ubuntu guide to install HAProxy and generate an SSL certificate using Let’s Encrypt.

ThingsBoard and Trendz can share a single domain — ThingsBoard at https://{my-domain}/ and Trendz at https://{my-domain}/trendz/.

In the frontend https_in section, add:

Terminal window
acl trendz_acl path_beg /trendz/ path_beg /apiTrendz/
use_backend tb-trendz if trendz_acl

See the Upgrade Instructions for detailed steps.

Trendz logs are stored in /var/log/trendz. Check for errors with:

Terminal window
cat /var/log/trendz/trendz.log | grep ERROR