- Prerequisites
- Step 1. Install Java 11 (OpenJDK)
- Step 2. Configure PostgreSQL
- Step 3. ThingsBoard Edge service installation
- Step 4. Configure ThingsBoard Edge
- Step 5. Run installation script
- Step 6. Restart ThingsBoard Edge service
- Step 7. Open ThingsBoard Edge UI
- Troubleshooting
- Next Steps
This guide describes how to install ThingsBoard Edge on RHEL/CentOS 7/8.
Prerequisites
ThingsBoard Cloud server
To begin using ThingsBoard Edge, you must have a ThingsBoard PE server supporting edge functionality up and running.
The easiest way is to use ThingsBoard Cloud server.
The alternative option is to install ThingsBoard Professional Edition server on-premise. Please visit Install PE to install server.
Edge provision on cloud
Additionally, you will need to provision ThingsBoard Edge on a cloud server. If you haven’t done so yet, please follow the Provision Edge on Cloud guide.
Once the ThingsBoard Edge is provisioned on the cloud server, please follow the installation steps provided below.
Edge Hardware Requirements
The hardware requirements for ThingsBoard Edge depend on the number of devices connected to the edge and the extent of GUI usage locally.
If you’re planning to run ThingsBoard Edge without heavy GUI usage (local dashboards, device management, etc.), and you have a relatively small number of devices (under 100) connected to a single machine, then a minimum of 1GB of RAM should suffice.
On the other hand, if you anticipate heavy GUI usage (local dashboards, device management, etc.) and you’re connecting 100+ devices on a single machine, we recommend having at least 4GB of RAM to ensure optimal performance.
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 11 (OpenJDK)
ThingsBoard service is running on Java 11. Follow this instructions to install OpenJDK 11:
1
sudo yum install java-11-openjdk
Please don’t forget to configure your operating system to use OpenJDK 11 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 "11.0.xx"
OpenJDK Runtime Environment (...)
OpenJDK 64-Bit Server VM (build ...)
Step 2. Configure PostgreSQL
ThingsBoard Edge uses PostgreSQL database as a local storage.
Instructions listed below will help you to install PostgreSQL.
1
2
# Update your system
sudo yum update
For CentOS 7:
1
2
3
4
5
6
7
8
9
10
11
12
# Install the repository RPM (for CentOS 7):
sudo yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# Install packages
sudo yum -y install epel-release yum-utils
sudo yum-config-manager --enable pgdg12
sudo yum install postgresql12-server postgresql12
# Initialize your PostgreSQL DB
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
sudo systemctl start postgresql-12
# Optional: Configure PostgreSQL to start on boot
sudo systemctl enable --now postgresql-12
For CentOS 8:
1
2
3
4
5
6
7
8
9
10
11
# Install the repository RPM (for CentOS 8):
sudo yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# Install packages
sudo dnf -qy module disable postgresql
sudo dnf -y install postgresql12 postgresql12-server
# Initialize your PostgreSQL DB
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
sudo systemctl start postgresql-12
# Optional: Configure PostgreSQL to start on boot
sudo systemctl enable --now postgresql-12
Once PostgreSQL is installed you may want to create a new user or set the password for the the main user. The instructions below will help to set the password for main postgresql user
1
2
3
4
sudo su - postgres
psql
\password
\q
Then, press “Ctrl+D” to return to main user console.
After configuring the password, edit the pg_hba.conf to use MD5 authentication with the postgres user.
Edit pg_hba.conf file:
1
sudo nano /var/lib/pgsql/12/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-12.service
Connect to the database to create ThingsBoard Edge DB:
1
psql -U postgres -d postgres -h 127.0.0.1 -W
Execute create database statement
1
2
CREATE DATABASE tb_edge;
\q
Step 3. ThingsBoard Edge service installation
Download installation package.
1
wget https://dist.thingsboard.io/tb-edge-3.5.1pe.rpm
Go to the download repository and install ThingsBoard Edge service
1
sudo rpm -Uvh tb-edge-3.5.1pe.rpm
Step 4. Configure ThingsBoard Edge
Edit ThingsBoard Edge configuration file
1
sudo nano /etc/tb-edge/conf/tb-edge.conf
Please update the following lines in your configuration file. Make sure to replace:
- “PUT_YOUR_POSTGRESQL_PASSWORD_HERE” with your actual postgres user password.
-
“PUT_YOUR_CLOUD_IP” with an IP address of the machine where ThingsBoard PE server is running. Depending on your setup:
- If you’re connecting the edge to ThingsBoard Cloud, use thingsboard.cloud.
NOTE: thingsboard.cloud employs the SSL protocol for edge communication. You should also uncomment export CLOUD_RPC_SSL_ENABLED=true in this case.
- Use localhost if the edge is running on the same machine as the cloud instance.
- Use an X.X.X.X IP address if the edge is connecting to the cloud instance in the same network or in a Docker container.
- Replace “PUT_YOUR_EDGE_KEY_HERE” and “PUT_YOUR_EDGE_SECRET_HERE” with the respective Edge key and secret (you can find these edge credentials in your cloud instance):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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 PE 'THINGSBOARD.CLOUD' SERVER:
# export CLOUD_RPC_HOST=thingsboard.cloud
# export CLOUD_RPC_SSL_ENABLED=true
# 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 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 INTEGRATIONS_RPC_PORT=19090
# 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 5. Run installation script
Once ThingsBoard Edge is installed and configured please execute the following install script:
1
sudo /usr/share/tb-edge/bin/install/install.sh
Step 6. Restart ThingsBoard Edge service
1
sudo service tb-edge restart
Step 7. Open ThingsBoard Edge UI
Once started, you will be able to open ThingsBoard Edge UI using the following link http://localhost:8080.
Please use your tenant credentials from local cloud instance or ThingsBoard Cloud 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:
-
Overview - Learn about ThingsBoard 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.
-
Push data from edge to cloud and vice versa - Learn how to push data from edge to cloud and vice versa.
-
- 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.