- Prerequisites
- Guided Installation Using ThingsBoard Server Pre-configured Instructions
- Manual Installation and Configuration
- Troubleshooting
- Next Steps
This guide describes how to install ThingsBoard Edge on Ubuntu 18.04 LTS / Ubuntu 20.04 LTS.
Prerequisites
To start running ThingsBoard Edge, you will need an active ThingsBoard account that supports Edge functionality.
Sign up for a ThingsBoard Cloud account, which is the easiest way to get started. Throughout the rest of this tutorial, this URL will be referred to as SERVER_URL Log in using your ThingsBoard Cloud tenant credentials. |
You can install the **ThingsBoard ** local server. For this, please refer to the ThingsBoard installation guide. The local server can be accessed via http://localhost:8080. Throughout this tutorial, we will refer to this URL as SERVER_URL. Log in with:
|
Edge Hardware Requirements
The hardware requirements for ThingsBoard Edge are determined by the number of connected devices and the intensity of interactions with the platform interface. To ensure optimal performance, we recommend the following:
- At least 1GB of RAM (Light workload): It is suitable for minimal interactions with the platform interface, such as dashboards and device management, and fewer than 100 connected devices.
- At least 4GB of RAM (Heavy workload): This configuration is suitable for intense platform interactions and 100+ devices connected to a single machine.
Deploying a New Edge Instance
To create a new Edge:
-
Sign in to your ThingsBoard PE instance and navigate to the Edge Management > Instances section. Click the ”+” icon in the top right corner and select the “Add new edge” option.
-
Enter a name for the Edge you are creating. For example, “My New Edge”. If needed, update the cloud endpoint.
- If the Edge runs in a Docker container, do not use “localhost” as the endpoint. Instead, use the IP address of the machine where ThingsBoard PE is hosted and accessible by the Edge container. For example, http://10.7.2.143:8080.
- If you are using the ThingsBoard Cloud, there’s no need to change this setting — keep it as is.
- Click the “Add” button to confirm the addition of the Edge instance.
-
Your new Edge is created and will appear at the top of the list, as entries are sorted by creation time by default.

Sign in to your ThingsBoard PE instance and navigate to the Edge Management > Instances section. Click the ”+” icon in the top right corner and select the “Add new edge” option.
{:target="_blank"}, do not use “localhost” as the endpoint. Instead, use the IP address of the machine where ThingsBoard PE is hosted and accessible by the Edge container. For example, http://10.7.2.143:8080.
If you are using the ThingsBoard Cloud, there’s no need to change this setting — keep it as is.
Click the "Add" button to confirm the addition of the Edge instance.](/images/pe/edge/installation-add-edge-item-2-preview.png)
Enter a name for the Edge you are creating. For example, “My New Edge”. If needed, update the cloud endpoint.
- If the Edge runs in a Docker container, do not use “localhost” as the endpoint. Instead, use the IP address of the machine where ThingsBoard PE is hosted and accessible by the Edge container. For example, http://10.7.2.143:8080.
- If you are using the ThingsBoard Cloud, there’s no need to change this setting — keep it as is.
- Click the “Add” button to confirm the addition of the Edge instance.

Your new Edge is created and will appear at the top of the list, as entries are sorted by creation time by default.
Guided Installation Using ThingsBoard Server Pre-configured Instructions
Once the Edge instance has been created, the installation instructions will be available for use. Each Edge has preset configurations that contain important credentials, such as Edge Secret, Edge Key, etc. To access these configurations:
-
Click on the Edge entity to open its details.
-
Click the “Install & Connection Instructions” button.
-
Follow the instructions to install Edge and connect it to the server.

Click on the Edge entity to open its details.

Click the “Install & Connection Instructions” button.

Follow the instructions to install Edge and connect it 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.
Step 1. Install Java 17 (OpenJDK)
ThingsBoard service is running on Java 17. Follow this instructions to install OpenJDK 17:
1
2
sudo apt update
sudo apt install openjdk-17-jdk
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 (...)
Step 2. Configure ThingsBoard Edge Database
ThingsBoard Edge supports SQL and hybrid database approaches. See the architecture page for details.
ThingsBoard Edge uses PostgreSQL database as a local storage. The following instructions will help you install PostgreSQL:
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. Connect to the “postgres” database as the “postgres” user:
Create the ThingsBoard Edge database and name it “tb_edge” :
Press “Ctrl+D” twice to quit PostgreSQL. |
PostgreSQL InstallationThe following instructions will help you install PostgreSQL:
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. Connect to the “postgres” database as the “postgres” user:
Create the ThingsBoard Edge database and name it “tb_edge” :
Press “Ctrl+D” twice to quit PostgreSQL. Cassandra InstallationThe instructions listed below will help you to install Cassandra.
In order to run Cassandra, install Java 11. Install the package:
Set Java 17 as the default version (required for ThingsBoard Edge):
Edit the Cassandra configuration file:
Find the following line:
And replace it as follows:
Then, restart Cassandra:
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 Edge instance to connect to external Cassandra nodes:
|
Step 3. Choose Queue Service
ThingsBoard Edge can use different messaging systems and brokers for storing messages and enabling communication between its services. Choose the appropriate queue implementation based on your specific business needs:
-
In Memory: The built-in and default queue implementation. It is useful for development or proof-of-concept (PoC) environments, but is not recommended for production or any type of clustered deployments due to limited scalability.
-
Kafka: Recommended for production deployments. This queue is used in 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. Install ZooKeeperKafka uses ZooKeeper so you need to first install ZooKeeper server:
Setup ZooKeeper Systemd Unit fileCreate systemd unit file for Zookeeper:
Add below content:
Enable and start ZooKeeper:
Install Kafka
Setup Kafka Systemd Unit fileCreate systemd unit file for Kafka:
Add the below content. Make sure to replace “PUT_YOUR_JAVA_PATH” with your real JAVA_HOME path as per the Java installed on your system, by default like “/usr/lib/jvm/java-11-openjdk-xxx”:
Enable and start Kafka:
ThingsBoard ConfigurationEdit the ThingsBoard Edge configuration file:
Add the following line to the tb-edge.conf file. Make sure to replace “localhost:9092” with your real Kafka bootstrap servers if necessary:
|
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 the installation package.
1
wget https://dist.thingsboard.io/tb-edge-3.9pe.deb
Go to the download repository and install ThingsBoard Edge service:
1
sudo dpkg -i tb-edge-3.9pe.deb
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 PE Server. This depends on your setup:
- If you’re connecting the Edge to ThingsBoard Cloud, use thingsboard.cloud.
NOTE: thingsboard.cloud uses the SSL protocol for communication with the Edge. 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 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
24
25
26
27
# 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 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
# export INTEGRATIONS_RPC_PORT=19090
# 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
# 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 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 Cloud to log in to the ThingsBoard Edge.
Troubleshooting
ThingsBoard Edge logs 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.