- Prerequisites
- Guided Installation Using ThingsBoard Server Pre-configured Instructions
- Manual Installation and Configuration
- Pre-installation step
- Step 1. Install Java 17 (OpenJDK)
- Step 2. Configure ThingsBoard Database
- Step 3. Choose Queue Service
- Step 4. ThingsBoard Edge Service Installation
- Step 5. Configure ThingsBoard Edge
- Step 6. Run installation Script
- Step 7. Restart ThingsBoard Edge Service
- Step 8. Open ThingsBoard Edge UI
- Troubleshooting
- Next Steps
This guide describes how to install ThingsBoard Edge on RHEL/CentOS 7/8.
Prerequisites
To start using the ThingsBoard Edge, it is essential to have a running ThingsBoard server that supports Edge functionality.
The easiest way is to use the Live Demo server.
Alternatively, you can install the ThingsBoard Community Edition server on-premise. For this, please refer to the ThingsBoard installation guide.
Edge Hardware Requirements
The hardware specifications required for ThingsBoard Edge are determined by both the number of locally connected devices and the level of GUI interaction:
-
Light Usage: If you intend to operate ThingsBoard Edge with minimal GUI interactions (such as local dashboards and device management) and expect to connect fewer than 100 devices to a single machine, at least 1GB of RAM should be sufficient.
-
Heavy Usage: Conversely, for heavy GUI interactions and connections to 100+ devices on a single machine, we recommend allocating at least 4GB of RAM to ensure optimal performance.
Provisioning a new Edge instance on the ThingsBoard server
Additionally, you will need to provision Edge on the ThingsBoard server.
-
Log in to your ThingsBoard PE instance and navigate to the Edge Management -> Instances section. Click the ”+” icon in the top right corner and select “Add new edge”.
-
Enter a name for your Edge. For instance, “My New Edge”. Click “Add” to confirm the addition of your new Edge.
-
Your new Edge should now appear at the top of the list, as entries are sorted by creation time by default.
Guided Installation Using ThingsBoard Server Pre-configured Instructions
The easiest way to install and connect the Edge to the Server is to follow the installation instructions provided by the ThingsBoard Server. For every Edge Entity, the Server displays the instructions with pre-populated fields such as the Edge secret key, Edge routing key, Edge RPC host URI, and so on
Please follow the steps below to use these prepared instructions:
-
Click an Edge entity row to open its details;
-
Click on the “Install & Connect Instructions” button;
-
Follow the instructions to install Edge and connect to the server.
Manual Installation and Configuration
If for any reason you are unable to use the prepared ThingsBoard Server Instructions above, please follow the steps below. These steps will guide you through installing and configuring the Edge by yourself.
Pre-installation step
Before continue to installation execute the following commands in order to install necessary tools:
1
2
sudo yum install -y nano wget
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
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
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. Configure ThingsBoard Database
ThingsBoard Edge supports SQL and hybrid database approaches. See the architecture page for details.
ThingsBoard Edge uses PostgreSQL database as a local storage. To install PostgreSQL, follow the instructions below.
Install the repository:
Install the package.
Once PostgreSQL is installed, you may want to create a new user or set the password for the main user. The following instructions will help you to set the password for the main PostgreSQL user. To switch your current user context to the postgres user, execute the following script:
To interact with the PostgreSQL database, enter:
You will connect to the database as the main PostgreSQL user. To set the password, enter the following command after postgres=# :
Enter and confirm the password. Then, press “Ctrl+D” to return to the main user console. Modifying PostgreSQL’s Authentication Method (Optional)Since ThingsBoard Edge uses the PostgreSQL database for local storage, configuring MD5 authentication ensures that only authenticated users or applications can access the database, thus protecting your data. After configuring the password, edit the pg_hba.conf file to use MD5 hashing for authentication instead of the default method (ident) for local IPv4 connections. Edit the pg_hba.conf file:
Locate the following lines:
Replace
Finally, restart the PostgreSQL service to initialize the new configuration:
Connect to the database to create ThingsBoard Edge DB:
Run the following command to create the database:
Press “Ctrl+D” twice to exit PostgreSQL. |
PostgreSQL InstallationTo install PostgreSQL, follow the instructions below.
Install the repository:
Install the package.
Once PostgreSQL is installed, you may want to create a new user or set the password for the main user. The following instructions will help you to set the password for the main PostgreSQL user. To switch your current user context to the postgres user, execute the following script:
To interact with the PostgreSQL database, enter:
You will connect to the database as the main PostgreSQL user. To set the password, enter the following command after postgres=# :
Enter and confirm the password. Then, press “Ctrl+D” to return to the main user console. Modifying PostgreSQL’s Authentication Method (Optional)Since ThingsBoard Edge uses the PostgreSQL database for local storage, configuring MD5 authentication ensures that only authenticated users or applications can access the database, thus protecting your data. After configuring the password, edit the pg_hba.conf file to use MD5 hashing for authentication instead of the default method (ident) for local IPv4 connections. Edit the pg_hba.conf file:
Locate the following lines:
Replace
Finally, restart the PostgreSQL service to initialize the new configuration:
Connect to the database to create ThingsBoard Edge DB:
Run the following command to create the database:
Press “Ctrl+D” twice to exit PostgreSQL. Cassandra InstallationIn order to run Cassandra, install Java 11:
Set Java 17 as the default version (required for ThingsBoard Edge):
Add the Cassandra repository:
Add the following content:
Update package index if necessary:
Install Cassandra:
Start Cassandra service:
ThingsBoard Edge ConfigurationEdit ThingsBoard Edge configuration file:
Add the following lines to the configuration file. Don’t forget to replace “PUT_YOUR_POSTGRESQL_PASSWORD_HERE” with your real postgres user password:
You can optionally add the following parameters to reconfigure your ThingsBoard Edge instance to connect to external Cassandra nodes:
|
Step 3. Choose Queue Service
ThingsBoard Edge is able to use different messaging systems/brokers for storing the messages and communication between ThingsBoard services. How to choose the right queue implementation?
-
In Memory queue implementation is built-in and default. It is useful for development(PoC) environments and is not suitable for production deployments or any sort of cluster deployments.
-
Kafka is recommended for production deployments. This queue is used on the most of ThingsBoard production environments now.
In Memory queue is built in and enabled by default. No additional configuration is required. |
Kafka InstallationApache Kafka is an open source stream processing platform. To install Kafka in a Docker container, follow the instructions below:
Add the following lines to the docker-compose-kafka.yml file:
Start the container:
ThingsBoard Edge ConfigurationEdit ThingsBoard Edge configuration file:
Add the following line to the configuration file. Replace “localhost:9092” with your real Kafka bootstrap servers if needed:
|
Step 4. ThingsBoard Edge Service Installation
Download installation package.
1
wget https://github.com/thingsboard/thingsboard-edge/releases/download/v3.9/tb-edge-3.9.rpm
Go to the download repository and install ThingsBoard Edge service
1
sudo rpm -Uvh tb-edge-3.9.rpm
Step 5. Configure ThingsBoard Edge
Click on Copy Edge Key and Copy Edge Secret in the edge details section. This will copy your edge credentials to your clipboard. Be sure to store them in a secure location, as these values will be needed in the following steps.
Edit the ThingsBoard Edge configuration file:
1
sudo nano /etc/tb-edge/conf/tb-edge.conf
Update the following lines in your configuration file. Be sure to replace:
- “PUT_YOUR_POSTGRESQL_PASSWORD_HERE” replace with your actual postgres user password.
-
“PUT_YOUR_CLOUD_IP” replace with an IP address of the machine running ThingsBoard Server. This depends on your setup:
-
If you’re connecting the Edge to the ThingsBoard Live Demo for evaluation, use demo.thingsboard.io.
- Use localhost if the Edge is running on the same machine as the Server instance.
- Use an X.X.X.X IP address if the Edge is connecting to the Server instance in the same network or in a Docker container.
-
- Replace “PUT_YOUR_EDGE_KEY_HERE” and “PUT_YOUR_EDGE_SECRET_HERE” with the appropriate Edge key and secret:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# UNCOMMENT NEXT LINES AND PUT YOUR CLOUD CONNECTION SETTINGS:
# export CLOUD_ROUTING_KEY=PUT_YOUR_EDGE_KEY_HERE
# export CLOUD_ROUTING_SECRET=PUT_YOUR_EDGE_SECRET_HERE
# UNCOMMENT NEXT LINES IF EDGE CONNECTS TO CE 'DEMO.THINGSBOARD.IO' SERVER:
# export CLOUD_RPC_HOST=demo.thingsboard.io
# UNCOMMENT NEXT LINES IF YOU ARE RUNNING EDGE ON THE SAME MACHINE WHERE THINGSBOARD SERVER IS RUNNING:
# export HTTP_BIND_PORT=18080
# export MQTT_BIND_PORT=11883
# export COAP_BIND_PORT=15683
# export LWM2M_ENABLED=false
# export SNMP_ENABLED=false
# UNCOMMENT NEXT LINES IF YOU CHANGED DEFAULT CLOUD RPC HOST/PORT SETTINGS:
# export CLOUD_RPC_HOST=PUT_YOUR_CLOUD_IP
# export CLOUD_RPC_PORT=7070
# UNCOMMENT NEXT LINES IF YOU HAVE CHANGED DEFAULT POSTGRESQL DATASOURCE SETTINGS:
# export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/tb_edge
# export SPRING_DATASOURCE_USERNAME=postgres
# export SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HERE
Step 6. Run installation Script
Once ThingsBoard Edge is installed and configured please execute the following installation script:
1
sudo /usr/share/tb-edge/bin/install/install.sh
Step 7. Restart ThingsBoard Edge Service
1
sudo service tb-edge restart
Step 8. Open ThingsBoard Edge UI
Once the Edge service is started, open the Edge UI at http://localhost:8080.
Please use your tenant credentials from local Server instance or ThingsBoard Live Demo to log in to the ThingsBoard Edge.
Troubleshooting
ThingsBoard Edge logs are stored in the following directory:
1
/var/log/tb-edge
You can issue the following command in order to check if there are any errors on the service side:
1
cat /var/log/tb-edge/tb-edge.log | grep ERROR
Start edge service:
1
sudo service tb-edge start
Stop edge service:
1
sudo service tb-edge stop
Restart edge service:
1
sudo service tb-edge restart
Check status of ThingsBoard Edge service:
1
sudo service tb-edge status
Next Steps
Congratulations! You have successfully provisioned, installed and connected ThingsBoard Edge to ThingsBoard server.
You can continue with Getting started guide to get the basic knowledge of ThingsBoard Edge or you can jump directly to more advanced topics:
-
Getting started guide - Provide quick overview of main ThingsBoard Edge features. Designed to be completed in 15-30 minutes:
-
Edge Rule Engine:
-
Rule Chain Templates - Learn how to use ThingsBoard Edge Rule Chain Templates.
-
Provision Rule Chains from cloud to edge - Learn how to provision edge rule chains from cloud to edge.
-
- Security:
- gRPC over SSL/TLS - Learn how to configure gRPC over SSL/TLS for communication between edge and cloud.
-
Features:
-
Edge Status - Learn about Edge Status page on ThingsBoard Edge.
-
Cloud Events - Learn about Cloud Events page on ThingsBoard Edge.
-
-
Use cases:
-
Manage alarms and RPC requests on edge devices - This guide will show how to generate local alarms on the edge and send RPC requests to devices connected to edge:
-
Data filtering and traffic reduce - This guide will show how to send to cloud from edge only filterd amount of device data:
-
- Roadmap - ThingsBoard Edge roadmap.