This guide describes how to install ThingsBoard on RHEL/CentOS 7/8. Hardware requirements depend on chosen database and amount of devices connected to the system. To run ThingsBoard and PostgreSQL on a single machine you will need at least 1Gb of RAM. To run ThingsBoard and Cassandra on a single machine you will need at least 8Gb of RAM.
Before continue to installation execute the following commands in order to install necessary tools:
For CentOS 7:
# Install wget
sudo yum install -y nano wget
# Add latest EPEL release for CentOS 7
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
For CentOS 8:
# Install wget
sudo yum install -y nano wget
# Add latest EPEL release for CentOS 8
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
ThingsBoard service is running on Java 8. Follow this instructions to install OpenJDK 8:
sudo yum install java-1.8.0-openjdk
Please don’t forget to configure your operating system to use OpenJDK 8 by default. You can configure which version is the default using the following command:
sudo update-alternatives --config java
You can check the installation using the following command:
java -version
Expected command output is:
openjdk version "1.8.0_xxx"
OpenJDK Runtime Environment (...)
OpenJDK 64-Bit Server VM (build ...)
Download installation package.
wget https://github.com/thingsboard/thingsboard/releases/download/v3.0.1/thingsboard-3.0.1.rpm
Install ThingsBoard as a service
sudo rpm -Uvh thingsboard-3.0.1.rpm
ThingsBoard is able to use SQL or hybrid database approach. See corresponding architecture page for more details.
PostgreSQL InstallationInstructions listed below will help you to install PostgreSQL.
For CentOS 7:
For CentOS 8:
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
Then, press “Ctrl+D” to return to main user console. After configuring the password, edit the pg_hba.conf to use MD5 authentication with the postgres user. Edit pg_hba.conf file:
Locate the following lines:
Replace
Finally, you should restart the PostgreSQL service to initialize the new configuration:
Connect to the database to create thingsboard DB:
Execute create database statement
ThingsBoard ConfigurationEdit ThingsBoard configuration file
Add the following lines to the configuration file. Don’t forget to replace “PUT_YOUR_POSTGRESQL_PASSWORD_HERE” with your real postgres user password:
|
PostgreSQL InstallationInstructions listed below will help you to install PostgreSQL.
For CentOS 7:
For CentOS 8:
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
Then, press “Ctrl+D” to return to main user console. After configuring the password, edit the pg_hba.conf to use MD5 authentication with the postgres user. Edit pg_hba.conf file:
Locate the following lines:
Replace
Finally, you should restart the PostgreSQL service to initialize the new configuration:
Connect to the database to create thingsboard DB:
Execute create database statement
Cassandra InstallationInstructions listed below will help you to install Cassandra.
ThingsBoard ConfigurationEdit ThingsBoard configuration file
Add the following lines to the configuration file. Don’t forget to replace “PUT_YOUR_POSTGRESQL_PASSWORD_HERE” with your real postgres user password:
You can optionally add the following parameters to reconfigure your ThingsBoard instance to connect to external Cassandra nodes:
|
PostgreSQL InstallationInstructions listed below will help you to install PostgreSQL.
For CentOS 7:
For CentOS 8:
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
Then, press “Ctrl+D” to return to main user console. After configuring the password, edit the pg_hba.conf to use MD5 authentication with the postgres user. Edit pg_hba.conf file:
Locate the following lines:
Replace
Finally, you should restart the PostgreSQL service to initialize the new configuration:
Connect to the database to create thingsboard DB:
Execute create database statement
TimescaleDB InstallationPlease refer to the official TimescaleDB installation page on RHEL/CentOS distros and follow the instructions in accordance with your installed PostgreSQL version. ThingsBoard ConfigurationEdit ThingsBoard configuration file
Add the following lines to the configuration file. Don’t forget to replace “PUT_YOUR_POSTGRESQL_PASSWORD_HERE” with your real postgres user password:
|
ThingsBoard is able to use various messaging systems/brokers for storing the messages and communication between ThingsBoard services. How to choose the right queue implementation?
In Memory queue implementation is built-in and default. It is useful for development(PoC) environments and is not suitable for production deployments or any sort of cluster deployments.
Kafka is recommended for production deployments. This queue is used on the most of ThingsBoard production environments now. It is useful for both on-prem and private cloud deployments. It is also useful if you like to stay independent from your cloud provider. However, some providers also have managed services for Kafka. See AWS MSK for example.
RabbitMQ is recommended if you don’t have much load and you already have experience with this messaging system.
AWS SQS is a fully managed message queuing service from AWS. Useful if you plan to deploy ThingsBoard on AWS.
Google Pub/Sub is a fully managed message queuing service from Google. Useful if you plan to deploy ThingsBoard on Google Cloud.
Azure Service Bus is a fully managed message queuing service from Azure. Useful if you plan to deploy ThingsBoard on Azure.
See corresponding architecture page and rule engine page for more details.
In Memory queue is built-in and enabled by default. No additional configuration steps required. |
Kafka InstallationApache Kafka is an open-source stream-processing software platform. Install KafkaWe recommend to use Kafka in Docker container, use this instruction for installing. ThingsBoard ConfigurationEdit ThingsBoard configuration file
Add the following line to the configuration file. Don’t forget to replace “localhost:9092” with your real Kafka bootstrap servers:
|
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:
|
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):
|
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”:
|
RabbitMQ InstallationUse this instruction for installing RabbitMQ. ThingsBoard ConfigurationEdit ThingsBoard configuration file
Add the following lines to the configuration file. Don’t forget to replace “YOUR_USERNAME” and “YOUR_PASSWORD” with your real user credentials, “localhost” and “5672” with your real RabbitMQ host and port:
|
Edit ThingsBoard configuration file
sudo nano /etc/thingsboard/conf/thingsboard.conf
Add the following lines to the configuration file.
# Update ThingsBoard memory usage and restrict it to 256MB in /etc/thingsboard/conf/thingsboard.conf
export JAVA_OPTS="$JAVA_OPTS -Xms256M -Xmx256M"
Once ThingsBoard service is installed and DB configuration is updated, you can execute the following script:
# --loadDemo option will load demo data: users, devices, assets, rules, widgets.
sudo /usr/share/thingsboard/bin/install/install.sh --loadDemo
ThingsBoard UI is accessible on 8080 port by default. Make sure that your 8080 port is accessible via firewall. In order to open 8080 port execute the following command:
sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent
sudo firewall-cmd --reload
Execute the following command to start ThingsBoard:
sudo service thingsboard start
Once started, you will be able to open Web UI using the following link:
http://localhost:8080/
The following default credentials are available if you have specified –loadDemo during execution of the installation script:
You can always change passwords for each account in account profile page.
Configure HAProxy to enable HTTPS
You may want to configure HTTPS access using HAProxy. This is possible in case you are hosting ThingsBoard in the cloud and have a valid DNS name assigned to your instance. Please follow this guide to install HAProxy and generate valid SSL certificate using Let’s Encrypt.
ThingsBoard logs are stored in the following directory:
/var/log/thingsboard
You can issue the following command in order to check if there are any errors on the backend side:
cat /var/log/thingsboard/thingsboard.log | grep ERROR
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 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.