Stand with Ukraine flag
Pricing Try it now
Trendz Analytics
Installation > On-premises > CentOS/RHEL Server
Getting Started Documentation Guides
How To Activate Trendz
On this page

Installing ThingsBoard Trendz Analytics on CentOS/RHEL

This guide explains how to install Trendz Analytics on RHEL/CentOS 8 or 9.

Important note before proceeding with RHEL/CentOS installation

Certain Trendz Analytics features like predictions, metric explorations, and Python calculation fields require a Python executor.

The python executor runs only via Docker. Even on RHEL/CentOS, Docker is essential to fully utilize all Trendz features. We recommend following the Docker (Linux or Mac OS) installation guide and using the Docker installation instead of RHEL/CentOS.

Proceed here only if you have a compelling reason to use a combined RHEL/CentOS + Docker setup.

Prerequisites

Hardware Requirements

Depends on the amount of analyzed data and the number of devices connected to the system. To run Trendz Analytics on a single machine, you will need at least 1Gb of free RAM.

In small and medium installations, Trendz can be installed on the same server with ThingsBoard.

Software Requirements

  • Have Docker CE. You can find out how to install it here
  • Have Docker Compose. You can find out how to install it here

  • ThingsBoard version 4.3.0 or newer. In case you have ThingsBoard version 4.2.1 or older, you could connect Trendz to ThingsBoard following the next guide.
  • Active Trendz Analytics addon. To find out how to activate it, please follow the next guide.

For CentOS 7:

1
2
3
4
5
# Install wget and nano
sudo yum install -y nano wget
# Add latest EPEL release for CentOS 7
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

For CentOS 8:

1
2
3
4
5
# Install wget and nano
sudo yum install -y nano wget
# Add latest EPEL release for CentOS 8
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Installation Steps

Step 1. Install Java 17 (OpenJDK)

ThingsBoard service is running on Java 17. Follow this instructions to install OpenJDK 17:

1
sudo dnf install java-17-openjdk-headless

Please don’t forget to configure your operating system to use OpenJDK 17 by default. You can configure which version is the default using the following command:

1
sudo update-alternatives --config java

You can check the installation using the following command:

1
java -version

Expected command output is:

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

Step 2. Trendz Analytics service installation

Download installation package.

1
wget https://dist.thingsboard.io/trendz-1.15.0.rpm

Install Trendz Analytics as a service

1
sudo rpm -Uvh trendz-1.15.0.rpm

Step 3. Configure Trendz database

Trendz uses PostgreSQL as a database. You can install PostgreSQL on the same serverfor Trendz or use managed PostgreSQL service from your cloud vendor.

  • PostgreSQL Installation

Instructions listed below will help you to install PostgreSQL.

1
2
# Update your system
sudo dnf update

Install the repository.

For CentOS/RHEL 8:

1
2
# Install the repository RPM:
sudo dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

For CentOS/RHEL 9:

1
2
# Install the repository RPM:
sudo dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm

Install the package.

1
2
3
4
5
6
7
8
# Install packages
sudo dnf -qy module disable postgresql
sudo dnf -y install postgresql16 postgresql16-server postgresql16-contrib
# Initialize your PostgreSQL DB
sudo /usr/pgsql-16/bin/postgresql-16-setup initdb
sudo systemctl start postgresql-16
# Optional: Configure PostgreSQL to start on boot
sudo systemctl enable --now postgresql-16

Once PostgreSQL is installed, it is recommended to set the password for the PostgreSQL main user.

The following command will switch the current user to the PostgreSQL user and set the password directly in PostgreSQL.

1
sudo -u postgres psql -c "\password"

Then, enter and confirm the password.

After configuring the password, edit the pg_hba.conf to use MD5 authentication with the postgres user.

Edit the pg_hba.conf file:

1
sudo nano /var/lib/pgsql/16/data/pg_hba.conf

Locate the following lines:

1
2
# IPv4 local connections:
host    all             all             127.0.0.1/32            ident

Replace ident with md5:

1
host    all             all             127.0.0.1/32            md5

Finally, you should restart the PostgreSQL service to initialize the new configuration:

1
sudo systemctl restart postgresql-16.service
  • Create Database for Trendz

Connect to the database to create trendz DB:

1
psql -U postgres -d postgres -h 127.0.0.1 -W

Execute create database statement

1
CREATE DATABASE trendz;

Then, press “Ctrl+D” to return to main user console.

  • Configure database connection for Trendz

Edit Trendz configuration file

1
sudo nano /etc/trendz/conf/trendz.conf

Add the following lines to the configuration file. Don’t forget to replace “PUT_YOUR_POSTGRESQL_PASSWORD_HERE” with your real postgres user password:

1
2
3
4
# 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

Step 4. Run installation script

Once Trendz service is installed and DB configuration is updated, you can execute the following script:

1
sudo /usr/share/trendz/bin/install/install.sh

Step 5. Start Trendz service

Execute the following command to start Trendz Analytics:

1
sudo service trendz start

Step 6. Sync ThingsBoard With Trendz

The final step is to verify that ThingsBoard is synchronized with Trendz. To do this:

  • Log in to ThingsBoard as a Sysadmin.
  • Open the Trendz Settings page.

If you see the message “Synchronization completed successfully”, the synchronization has been completed automatically and no further action is required.

If you see an error message, follow these steps:

  • Make sure that Trendz is running.
  • Enter the correct Trendz internal URL. It must be accessible from the ThingsBoard service.
  • Enter the correct ThingsBoard internal URL. It must be accessible from the Trendz service.
  • Click Save configuration.
  • Click Retry discovery.

Once the message “Synchronization completed successfully” appears, the synchronization is complete.

Step 7. Install Trendz Python Executor

To utilize all Trendz capabilities, such as Trendz Python Calculation Fields or Prediction Models, it is essential to install an additional service: the Trendz Python Executor, which can securely run Python code.

You can learn more about how to install it here.

Authentication

You can access Trendz UI by default at http://localhost:8888

Trendz uses ThingsBoard as an authentication service, so for first authentication, you need to use Tenant Administrator credentials from your ThingsBoard.

Topology Discovery

After the first login to Trendz, you need to discover topology to allow Trendz to know about assets, devices, their profiles and relations:

  • Click the Discover Topology button to start topology discovery process.
  • Wait until your topology will be discovered.
  • Click the Finish button to close topology discovery page and unlock the main Trendz functionality.

You could read more about how Trendz uses this topology here.

Troubleshooting

Trendz logs are stored in the following directory:

1
/var/log/trendz

You can issue the following command in order to check if there are any errors on the backend side:

1
cat /var/log/trendz/trendz.log | grep ERROR

HTTPS configuration

You may want to configure HTTPS access using HAProxy. This is possible in case you are hosting Trendz in the cloud and have a valid DNS name assigned to your instance.

Trendz and ThingsBoard hosted on the same server

Use this section if HAProxy/Let’s Encrypt already installed in the server and HTTPS enabled for ThingsBoard.

Open HAProxy configuration file

1
sudo nano /etc/haproxy/haproxy.cfg

Locate frontend https_in section, add new access list that will match traffic by domain name and redirect this traffic to Trendz backend:

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

In the same file register Trendz backend:

1
2
3
4
5
6
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 SSL certificates for new domain:

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

Refresh HAProxy configuration:

1
sudo haproxy-refresh

That’s it, HTTPS for Trendz UI configured and now you can access it via: https://new-trendz-domain.com

Fresh installation on new server

Please follow this guide to install HAProxy and generate valid SSL certificate using Let’s Encrypt.

Host ThingsBoard and Trendz on the same domain

ThingsBoard and Trendz can share same domain name. In this case ThingsBoard web page would be loaded using following link:

1
https://{my-domain}/

and Trendz web page would be loaded using following link

1
https://{my-domain}/trendz/

For enabling such configuration we have to update HAProxy config to route specific requests to Trendz service. Open HAProxy configuration file

1
sudo nano /etc/haproxy/haproxy.cfg

Locate frontend https_in section, add new access list that will match traffic by URL path and redirect this traffic to Trendz backend:

1
2
3
4
...
acl trendz_acl path_beg /trendz/ path_beg /apiTrendz/
....
use_backend tb-trendz if trendz_acl

Next steps

  • Getting started guide - These guide provide quick overview of main Trendz features.

  • Metric Explorer - Learn how to explore and create new metrics with Trendz Metric Explorer.

  • Anomaly Detection - Learn how to identify anomalies in the data.

  • Calculated Fields - Learn about Calculated fields and how to use them.

  • States - Learn how to define and analyse states for assets based on raw telemetry.

  • Prediction - Learn how to make forecasts and predict telemetry behavior.

  • Filters - Learn how filter dataset during analysis.

  • Available Visualizations - Learn about visualization widgets available in Trendz and how to configure them.

  • Share and embed Visualizations - Learn how to add Trendz visualizations on ThingsBoard dashboard or 3rd party web pages.

  • AI Assistant - Learn how to utilize Trendz AI capabilities.