- Third-party components installation
- Step 1. Install Java 11 (OpenJDK)
- Step 2. ThingsBoard service installation
- Step 3. Configure ThingsBoard database
- Step 4. Choose ThingsBoard queue service
- Step 5. Memory update for slow machines (4GB of RAM)
- Step 6. Run installation script
- Step 7. Start ThingsBoard service
- Troubleshooting
- Next steps
This guide describes how to install ThingsBoard on a Raspberry Pi running Raspbian Buster.
Third-party components installation
Step 1. Install Java 11 (OpenJDK)
1
2
3
4
5
6
7
8
9
10
11
# Add repository.
echo "deb http://deb.debian.org/debian unstable main non-free contrib" | sudo tee /etc/apt/sources.list
# Run system update.
sudo apt update
# Install JAVA
sudo apt install openjdk-11-jdk
#Check installation
java -version
Step 2. ThingsBoard service installation
Download installation package.
1
wget https://github.com/thingsboard/thingsboard/releases/download/v3.6.4/thingsboard-3.6.4.deb
Install ThingsBoard as a service
1
sudo dpkg -i thingsboard-3.6.4.deb
Step 3. Configure ThingsBoard database
PostgreSQL Installation
Instructions listed below will help you to install PostgreSQL.
1
2
3
4
5
6
7
8
9
10
11
12
13
# 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:
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 launch the postgresql service:
sudo apt update
sudo apt -y install postgresql
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 DB:
1
2
3
psql -U postgres -d postgres -h 127.0.0.1 -W
CREATE DATABASE thingsboard;
\q
ThingsBoard Configuration
Edit ThingsBoard configuration file
1
sudo nano /etc/thingsboard/conf/thingsboard.conf
Add the following lines to the configuration file. Don’t forget to replace “PUT_YOUR_POSTGRESQL_PASSWORD_HERE” with your real postgres user password:
1
2
3
4
5
6
7
# DB Configuration
export DATABASE_TS_TYPE=sql
export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/thingsboard
export SPRING_DATASOURCE_USERNAME=postgres
export SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HERE
# Specify partitioning size for timestamp key-value storage. Allowed values: DAYS, MONTHS, YEARS, INDEFINITE.
export SQL_POSTGRES_TS_KV_PARTITIONING=MONTHS
Step 4. Choose ThingsBoard queue service
ThingsBoard uses queue services for API calls between micro-services and able to use next queue services: In Memory (default), AWS SQS, Google Pub/Sub or Azure Service Bus.
In Memory queue is built-in and enabled by default. No additional configuration steps required. |
AWS SQS ConfigurationTo access AWS SQS service, you first need to create an AWS account. To work with AWS SQS service you will need to create your next credentials using this instruction:
ThingsBoard ConfigurationEdit ThingsBoard configuration file
Add the following lines to the configuration file. Don’t forget to replace “YOUR_KEY”, “YOUR_SECRET” with your real AWS SQS IAM user credentials and “YOUR_REGION” with your real AWS SQS account region:
You can update default Rule Engine queues configuration (poll interval and partitions) using UI. More about ThingsBoard Rule Engine queues see in documentation. |
Google Pub/Sub ConfigurationTo access Pub/Sub service, you first need to create an Google cloud account. To work with Pub/Sub service you will need to create a project using this instruction. Create service account credentials with the role “Editor” or “Admin” using this instruction, and save json file with your service account credentials step 9 here. ThingsBoard ConfigurationEdit ThingsBoard configuration file
Add the following lines to the configuration file. Don’t forget to replace “YOUR_PROJECT_ID”, “YOUR_SERVICE_ACCOUNT” with your real Pub/Sub project id, and service account (it is whole data from json file):
You can update default Rule Engine queues configuration (poll interval and partitions) using UI. More about ThingsBoard Rule Engine queues see in documentation. |
Azure Service Bus ConfigurationTo access Azure Service Bus, you first need to create an Azure account. To work with Service Bus service you will need to create a Service Bus Namespace using this instruction. Create Shared Access Signature using this instruction. ThingsBoard ConfigurationEdit ThingsBoard configuration file
Add the following lines to the configuration file. Don’t forget to replace “YOUR_NAMESPACE_NAME” with your real Service Bus namespace name, and “YOUR_SAS_KEY_NAME”, “YOUR_SAS_KEY” with your real Service Bus credentials. Note: “YOUR_SAS_KEY_NAME” it is “SAS Policy”, “YOUR_SAS_KEY” it is “SAS Policy Primary Key”:
You can update default Rule Engine queues configuration (poll interval and partitions) using UI. More about ThingsBoard Rule Engine queues see in documentation. |
Confluent Cloud ConfigurationTo access Confluent Cloud you should first create an account, then create a Kafka cluster and get your API Key. ThingsBoard ConfigurationEdit ThingsBoard configuration file
Add the following lines to the configuration file. Don’t forget to replace “CLUSTER_API_KEY”, “CLUSTER_API_SECRET” and “localhost:9092” with your real Confluent Cloud bootstrap servers:**
You can update default Rule Engine queues configuration using UI. More about ThingsBoard Rule Engine queues see in documentation. |
Step 5. Memory update for slow machines (4GB of RAM)
Edit ThingsBoard configuration file
1
sudo nano /etc/thingsboard/conf/thingsboard.conf
Add the following lines to the configuration file.
1
2
# Update ThingsBoard memory usage and restrict it to 2G in /etc/thingsboard/conf/thingsboard.conf
export JAVA_OPTS="$JAVA_OPTS -Xms2G -Xmx2G"
Step 6. Run installation script
Once ThingsBoard service is installed and DB configuration is updated, you can execute the following script:
1
2
# --loadDemo option will load demo data: users, devices, assets, rules, widgets.
sudo /usr/share/thingsboard/bin/install/install.sh --loadDemo
Step 7. Start ThingsBoard service
Execute the following command to start ThingsBoard:
1
sudo service thingsboard start
Once started, you will be able to open Web UI using the following link:
1
http://localhost:8080/
The following default credentials are available if you have specified –loadDemo during execution of the installation script:
- System Administrator: sysadmin@thingsboard.org / sysadmin
- Tenant Administrator: tenant@thingsboard.org / tenant
- Customer User: customer@thingsboard.org / customer
You can always change passwords for each account in account profile page.
Troubleshooting
ThingsBoard logs are stored in the following directory:
1
/var/log/thingsboard
You can issue the following command in order to check if there are any errors on the backend side:
1
cat /var/log/thingsboard/thingsboard.log | grep ERROR
Next steps
-
Getting started guides - These guides provide quick overview of main ThingsBoard features. Designed to be completed in 15-30 minutes.
-
Connect your device - Learn how to connect devices based on your connectivity technology or solution.
-
Data visualization - These guides contain instructions on how to configure complex ThingsBoard dashboards.
-
Data processing & actions - Learn how to use ThingsBoard Rule Engine.
-
IoT Data analytics - Learn how to use rule engine to perform basic analytics tasks.
-
Hardware samples - Learn how to connect various hardware platforms to ThingsBoard.
-
Advanced features - Learn about advanced ThingsBoard features.
-
Contribution and Development - Learn about contribution and development in ThingsBoard.