Installing ThingsBoard CE on Raspberry Pi
This guide walks you through installing ThingsBoard Community 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://github.com/thingsboard/thingsboard/releases/download/v4.3.1.1/thingsboard-4.3.1.1.debInstall ThingsBoard as a service:
sudo dpkg -i thingsboard-4.3.1.1.debStep 3. Configure database
Section titled “Step 3. 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 4. Choose queue service
Section titled “Step 4. 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 5. Memory configuration
Section titled “Step 5. 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 6. Run installation script
Section titled “Step 6. Run installation script”sudo /usr/share/thingsboard/bin/install/install.sh --loadDemoStep 7. Start ThingsBoard
Section titled “Step 7. 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.
Upgrading
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