Edge
ThingsBoard Documentation
Cloud Professional Edition Community Edition Edge IoT Gateway License Server Trendz Analytics
Try it now Pricing
Getting Started Documentation
Architecture

On this page

Installing ThingsBoard Edge on Ubuntu Server

This guide describes how to install ThingsBoard Edge on Ubuntu 18.04 LTS / Ubuntu 20.04 LTS.

Prerequisites

ThingsBoard Cloud server

To start using ThingsBoard Edge you need to have ThingsBoard CE/PE server that supports edge functionality up and running.

The easiest way is to use Live Demo server.
The alternative option is to install ThingsBoard Community Edition server that supports edge functionality on-premise. Please visit Install CE to install 3.3 version or higher of server that supports edge functionality.

The easiest way is to use ThingsBoard Cloud server.
The alternative option is to install ThingsBoard Professional Edition server that supports edge functionality on-premise. Please visit Install PE to install 3.3 version or higher of server that supports edge functionality.

Edge provision on cloud

Additionally, you will need to provision ThingsBoard Edge on cloud server. Please visit this guide Provision edge on CE server or Provision edge on PE server respectively.

Once ThingsBoard Edge provisioned on cloud server please follow installation steps below.

Edge hardware requirements

Hardware requirements depend on an amount of devices connected to the edge and GUI usage locally.

To run ThingsBoard Edge without heavily usage of GUI (local dashboards, device management etc.) and relatively small amount of devices (under 100) on a single machine you will need at least 1GB of RAM.

To run ThingsBoard Edge with heavily usage of GUI (local dashboards, device management etc.) and with 100+ devices on a single machine we recommend having at least 4GB of RAM.

Step 1. Install Java 11 (OpenJDK)

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

1
2
sudo apt update
sudo apt install openjdk-11-jdk

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
3
4
5
6
7
8
9
10
11
12
13
14
# install **wget** if not already installed:
sudo apt install -y wget

# import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

# add repository contents to your system:
RELEASE=$(lsb_release -cs)
echo "deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}"-pgdg main | sudo tee  /etc/apt/sources.list.d/pgdg.list

# install and launch the postgresql service:
sudo apt update
sudo apt -y install postgresql-12
sudo service postgresql start

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 and connect to the database to create ThingsBoard Edge DB:

1
2
3
psql -U postgres -d postgres -h 127.0.0.1 -W
CREATE DATABASE tb_edge;
\q

Step 3. ThingsBoard Edge service installation

Download installation package.

1
wget https://dist.thingsboard.io/tb-edge-3.3.deb

Go to the download repository and install ThingsBoard Edge service

1
sudo dpkg -i tb-edge-3.3.deb

Step 4. Configure ThingsBoard Edge

Edit ThingsBoard Edge configuration file

1
sudo nano /etc/tb-edge/conf/tb-edge.conf

Update the following lines in the configuration file. Don’t forget to replace:

  • “PUT_YOUR_POSTGRESQL_PASSWORD_HERE” with your real postgres user password.
  • “PUT_YOUR_CLOUD_IP” with an IP address of the machine where ThingsBoard Professional Edition/Community Edition server is running:

    NOTE: thingsboard.cloud uses SSL protocol for edge communication. Please uncomment export CLOUD_RPC_SSL_ENABLED=true as well.

    • Use localhost in case edge is running on the same machine where cloud instance is running.
    • Use X.X.X.X IP address in case edge is connecting to the cloud instance in the same network or in the docker.
    • Or use demo.thingsboard.io if you are connecting edge to ThingsBoard Live Demo for evaluation.
  • “PUT_YOUR_EDGE_KEY_HERE” and “PUT_YOUR_EDGE_SECRET_HERE” with Edge key and secret respectively (edge credentials you can find in 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 EDGE CONNECTS TO CE 'DEMO.THINGSBOARD.IO' SERVER:
# export CLOUD_RPC_HOST=demo.thingsboard.io

# 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

# 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

If ThingsBoard Edge is going to be running on the same machine where ThingsBoard Professional Edition/Community Edition server is running you’ll need to update additional configuration parameters to avoid port collision.

Please uncomment next parameters in ThingsBoard Edge configuration file (/etc/tb-edge/conf/tb-edge.conf):
export HTTP_BIND_PORT=18080
export MQTT_BIND_PORT=11883
export COAP_BIND_PORT=15683

Please make sure ports above are not used by any other application.

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.

If during installation process you have changed edge HTTP_BIND_PORT please use that port instead for Edge UI URL:

http://localhost:HTTP_BIND_PORT

Please use your tenant credentials from local cloud instance, ThingsBoard Cloud or ThingsBoard Live Demo to log in to the ThingsBoard Edge.

Troubleshootings

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: