Skip to content
Stand with Ukraine flag

Installing ThingsBoard Edge on Raspberry Pi

This guide provides step-by-step instructions for installing ThingsBoard Edge on Raspberry Pi.

To run ThingsBoard Edge, you need an active ThingsBoard Professional Edition account that supports Edge functionality.

You can use ThingsBoard Cloud or install a local ThingsBoard PE server.

The hardware requirements for ThingsBoard Edge depend on the number of connected devices and platform interaction intensity.

WorkloadRAMDescription
Light1 GBFewer than 100 devices, minimal dashboard/device management usage
Heavy4 GB100+ devices or intense platform interactions

To create a new Edge instance on your ThingsBoard Server:

  1. Sign in to your ThingsBoard PE instance and go to Edge Management → Instances. Click Add (+) in the top-right corner and select Add new edge.
  2. Enter a name for the Edge, like My New Edge.

    If needed, update the Cloud endpoint. If Edge runs in a Docker container, do not use localhost — use the IP address of the machine where ThingsBoard PE is hosted (e.g., http://10.7.2.143:8080). If you use ThingsBoard Cloud, keep the default. Click Add.
  3. Your new Edge instance is created and appears at the top of the list.

Guided installation using ThingsBoard Server instructions

Section titled “Guided installation using ThingsBoard Server instructions”

Once an Edge instance is created, the server generates pre-configured installation instructions containing the Edge credentials (Edge Key, Edge Secret, etc.). To access them:

  1. Click the Edge entity to open its details.
  2. Click Install & Connection Instructions.
  3. Select the installation method and follow the instructions to install Edge and connect it to the server.

If you are unable to use the guided instructions above, follow the steps below to install and configure Edge manually.

ThingsBoard Edge requires Java 17. To install OpenJDK 17:

Terminal window
sudo apt update && sudo apt install openjdk-17-jdk-headless

Configure your operating system to use OpenJDK 17 by default:

Terminal window
sudo update-alternatives --config java

Verify the installation:

Terminal window
java -version

The expected output:

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

Step 2. Configure the ThingsBoard Edge database

Section titled “Step 2. Configure the ThingsBoard Edge database”

ThingsBoard Edge uses PostgreSQL as its local database.

Install PostgreSQL:

Terminal window
# 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 the repository to your system:
echo "deb https://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
# Install and start PostgreSQL:
sudo apt update
sudo apt -y install postgresql
sudo service postgresql start

Set the password for the main PostgreSQL user:

Terminal window
sudo -u postgres psql -c "\password"

Enter and confirm the password when prompted.

Create a new PostgreSQL database named tb_edge:

Terminal window
echo "CREATE DATABASE tb_edge;" | psql -U postgres -d postgres -h 127.0.0.1 -W

Add the database connection settings to the ThingsBoard Edge configuration file:

Terminal window
sudo bash -c 'cat >> /etc/tb-edge/conf/tb-edge.conf <<EOL
export DATABASE_TS_TYPE=sql
export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/tb_edge
export SPRING_DATASOURCE_USERNAME=postgres
export SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HERE
export SQL_POSTGRES_TS_KV_PARTITIONING=MONTHS
EOL'

Replace PUT_YOUR_POSTGRESQL_PASSWORD_HERE with your actual PostgreSQL password.

SQL_POSTGRES_TS_KV_PARTITIONING sets the partitioning interval for time-series storage. Allowed values: DAYS, MONTHS, YEARS, INDEFINITE.

Step 3. Download and install ThingsBoard Edge

Section titled “Step 3. Download and install ThingsBoard Edge”
Terminal window
wget https://dist.thingsboard.io/tb-edge-4.3.1.1EDGEPE.deb
sudo dpkg -i tb-edge-4.3.1.1EDGEPE.deb

In the Edge instance details panel, click Copy Edge Key and Copy Edge Secret. Store these values — you need them in the next step.

Edit the ThingsBoard Edge configuration file to set your Edge credentials and cloud connection parameters.

Use this configuration to connect to ThingsBoard Cloud hosted in North America.

Terminal window
sudo sh -c 'cat <<EOL >> /etc/tb-edge/conf/tb-edge.conf
export CLOUD_ROUTING_KEY=PUT_YOUR_EDGE_KEY_HERE
export CLOUD_ROUTING_SECRET=PUT_YOUR_EDGE_SECRET_HERE
export CLOUD_RPC_HOST=thingsboard.cloud
export CLOUD_RPC_PORT=7070
export CLOUD_RPC_SSL_ENABLED=true
export INTEGRATIONS_RPC_PORT=19090
EOL'

Configuration parameters:

ParameterDescription
CLOUD_ROUTING_KEYYour Edge key (copied above)
CLOUD_ROUTING_SECRETYour Edge secret (copied above)
CLOUD_RPC_HOSTHostname or IP address of the ThingsBoard Server
CLOUD_RPC_PORTgRPC port used for Edge–server communication (default: 7070)
CLOUD_RPC_SSL_ENABLEDSet to true to enable SSL — required when connecting to ThingsBoard Cloud
INTEGRATIONS_RPC_PORTPort used for integration communication between Edge and ThingsBoard PE

Step 5. [Optional] Tune JVM memory for low-memory devices

Section titled “Step 5. [Optional] Tune JVM memory for low-memory devices”

On devices with limited RAM, you can constrain the JVM heap size to prevent out-of-memory issues:

Terminal window
echo 'export JAVA_OPTS="$JAVA_OPTS -Xms512M -Xmx1G"' | sudo tee -a /etc/tb-edge/conf/tb-edge.conf
ParameterDescription
-Xms512MInitial JVM heap size — 512 MB
-Xmx1GMaximum JVM heap size — 1 GB

Adjust these values based on available RAM. A good rule of thumb: set -Xmx to half the total RAM if ThingsBoard Edge is the only memory-intensive process, or one-third if other services are also running.

Once ThingsBoard Edge is installed and configured, execute the installation script:

Terminal window
sudo /usr/share/tb-edge/bin/install/install.sh

Start the ThingsBoard Edge service:

Terminal window
sudo service tb-edge start

Once the service is running, open the Edge UI at http://localhost:8080, or replace localhost with your Raspberry Pi’s local IP address if accessing from another device on the network.

Log in using your tenant credentials from ThingsBoard Server or ThingsBoard Cloud.

ThingsBoard Edge logs are stored in:

Terminal window
/var/log/tb-edge

To check for errors:

Terminal window
cat /var/log/tb-edge/tb-edge.log | grep ERROR

To stop the ThingsBoard Edge service:

Terminal window
sudo service tb-edge stop

To restart the ThingsBoard Edge service:

Terminal window
sudo service tb-edge restart

To check the status of the ThingsBoard Edge service:

Terminal window
sudo service tb-edge status