Installing ThingsBoard PE on Raspberry Pi
This guide walks you through installing ThingsBoard Professional Edition on a Raspberry Pi.
Prerequisites
Section titled “Prerequisites”- Raspberry Pi with at least 4 GB of RAM
- Raspberry Pi OS (64-bit recommended)
Step 1. Install Java 17 (OpenJDK)
Section titled “Step 1. Install Java 17 (OpenJDK)”sudo apt updatesudo apt install -y openjdk-17-jdkSet Java 17 as the default version:
sudo update-alternatives --config javaVerify the installation:
java -versionStep 2. Install ThingsBoard package
Section titled “Step 2. Install ThingsBoard package”Download the installation package:
wget https://dist.thingsboard.io/thingsboard-4.3.1.1PE.debInstall ThingsBoard as a service:
sudo dpkg -i thingsboard-4.3.1.1PE.debStep 3. Obtain and configure license key
Section titled “Step 3. Obtain and configure license key”We assume you have already chosen your subscription plan or decided to purchase a perpetual license. If not, navigate to the pricing page to select the best license option for your case. See How to get a pay-as-you-go subscription or How to get a perpetual license for details.
Once you have the license secret, add it to the ThingsBoard configuration file:
sudo nano /etc/thingsboard/conf/thingsboard.confLocate the following block:
# License secret obtained from ThingsBoard License Portal (https://license.thingsboard.io)# UNCOMMENT NEXT LINE AND PUT YOUR LICENSE SECRET:# export TB_LICENSE_SECRET=Uncomment the export statement and add your license secret:
export TB_LICENSE_SECRET=YOUR_LICENSE_SECRET_HEREStep 4. Configure database
Section titled “Step 4. Configure database”Install PostgreSQL 16:
sudo apt install -y postgresql-commonsudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.shsudo apt updatesudo apt -y install postgresql-16sudo service postgresql startSet a password for the postgres user:
sudo -u postgres psql -c "\password"Enter and confirm the password when prompted. Connect to PostgreSQL and create the ThingsBoard database:
psql -U postgres -d postgres -h 127.0.0.1 -WCREATE DATABASE thingsboard;Press Ctrl+D twice to exit.
Configure ThingsBoard to use PostgreSQL. Edit the configuration file:
sudo nano /etc/thingsboard/conf/thingsboard.confAdd the following lines. Replace PUT_YOUR_POSTGRESQL_PASSWORD_HERE with your actual postgres password:
# DB Configurationexport DATABASE_TS_TYPE=sqlexport SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/thingsboardexport SPRING_DATASOURCE_USERNAME=postgresexport SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HEREStep 5. Choose queue service
Section titled “Step 5. Choose queue service”ThingsBoard uses a message broker for internal communication between services. Choose one of the options below:
- In Memory — built-in, default. Suitable for development and PoC environments. Not recommended for production or cluster deployments.
- Confluent Cloud — fully managed streaming platform based on Kafka. Useful for cloud-agnostic deployments.
In Memory queue is built-in and enabled by default. No configuration needed.
To use Confluent Cloud, first create an account, then create a Kafka cluster and obtain your API Key.
Edit the ThingsBoard configuration file:
sudo nano /etc/thingsboard/conf/thingsboard.confAdd the following lines. Replace CLUSTER_API_KEY, CLUSTER_API_SECRET, and localhost:9092 with your Confluent Cloud values:
export TB_QUEUE_TYPE=kafkaexport TB_QUEUE_KAFKA_USE_CONFLUENT_CLOUD=trueexport TB_KAFKA_SERVERS=localhost:9092export TB_QUEUE_KAFKA_REPLICATION_FACTOR=3export TB_QUEUE_KAFKA_CONFLUENT_SASL_JAAS_CONFIG='org.apache.kafka.common.security.plain.PlainLoginModule required username="CLUSTER_API_KEY" password="CLUSTER_API_SECRET";'export TB_QUEUE_CORE_POLL_INTERVAL_MS=1000export TB_QUEUE_CORE_PARTITIONS=2export TB_QUEUE_RULE_ENGINE_POLL_INTERVAL_MS=1000export TB_QUEUE_TRANSPORT_REQUEST_POLL_INTERVAL_MS=1000export TB_QUEUE_TRANSPORT_RESPONSE_POLL_INTERVAL_MS=1000export TB_QUEUE_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS=1000export TB_QUEUE_VC_INTERVAL_MS=1000export TB_QUEUE_VC_PARTITIONS=1You can update the default Rule Engine queue configuration using the UI. See Rule Engine Queues for details.
Step 6. Memory configuration
Section titled “Step 6. Memory configuration”Raspberry Pi devices typically have limited RAM. Edit the ThingsBoard configuration file:
sudo nano /etc/thingsboard/conf/thingsboard.confAdd or update the following environment variable. Set the value to half of your total RAM (e.g. 2G for a 4 GB Raspberry Pi):
export JAVA_OPTS="$JAVA_OPTS -Xms2G -Xmx2G"Step 7. Run installation script
Section titled “Step 7. Run installation script”sudo /usr/share/thingsboard/bin/install/install.sh --loadDemoStep 8. Start ThingsBoard
Section titled “Step 8. Start ThingsBoard”sudo service thingsboard startOnce started, open http://localhost:8080 in your browser. You should see the ThingsBoard login page. Use the following default credentials:
- System Administrator: [email protected] / sysadmin
- Tenant Administrator: [email protected] / tenant
- Customer User: [email protected] / customer
You can change passwords for each account in the account profile page.
See Getting Started for your next steps after login.
Step 9. Install ThingsBoard WebReport component
Section titled “Step 9. Install ThingsBoard WebReport component”The WebReport service generates PDF and PNG reports from dashboards. Choose one of the installation methods below:
Install Docker:
curl -fsSL https://get.docker.com -o get-docker.shsudo sh get-docker.shCreate the Docker Compose file:
nano tb-web-report.ymlAdd the following content:
version: '3.0'services: tb-web-report: container_name: tb-web-report restart: always image: "thingsboard/tb-pe-web-report:4.3.1.1PE" ports: - "8383:8383" env_file: - ./tb-web-report.envCreate the environment file:
nano tb-web-report.envAdd the following content:
HTTP_BIND_ADDRESS=0.0.0.0HTTP_BIND_PORT=8383LOGGER_LEVEL=infoLOG_FOLDER=logsLOGGER_FILENAME=tb-web-report-%DATE%.logDOCKER_MODE=trueDEFAULT_PAGE_NAVIGATION_TIMEOUT=120000DASHBOARD_LOAD_WAIT_TIME=3000USE_NEW_PAGE_FOR_REPORT=trueStart the WebReport service:
docker compose -f tb-web-report.yml up -dCheck the container logs:
docker logs -f tb-web-reportDownload the WebReport installation package:
wget https://dist.thingsboard.io/tb-web-report-4.3.1.1PE.debInstall required libraries:
sudo apt install -yq libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \ libexpat1 libfontconfig1 libgcc1 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \ libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \ libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \ ca-certificates fonts-liberation libnss3 lsb-release xdg-utils unzip wget libgbm-devInstall Roboto fonts:
sudo apt install -y fonts-robotoInstall and start the WebReport service:
sudo dpkg -i tb-web-report-4.3.1.1PE.debsudo service tb-web-report startUpgrading
Section titled “Upgrading”The upgrade procedure for Raspberry Pi is identical to the Ubuntu instructions.
See the Upgrade Instructions for detailed steps.
Troubleshooting
Section titled “Troubleshooting”ThingsBoard logs are stored in /var/log/thingsboard. Check for errors with:
cat /var/log/thingsboard/thingsboard.log | grep ERROR