This guide describes how to install ThingsBoard on RHEL 8/9, CentOS 8/9, or their derivatives (Alma, Rocky, Oracle, etc). 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 4Gb 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 8:
# Install wget sudo dnf install -y nano wget # Add latest EPEL release for CentOS 8 sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
For CentOS 9:
Copy to clipboard1 2 3 4# Install wgetsudo dnf install -y nano wget# Add latest EPEL release for CentOS 9sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
ThingsBoard service is running on Java 17. Follow this instructions to install OpenJDK 17:
Copy to clipboardsudo dnf install java-17-openjdk
Please don’t forget to configure your operating system to use OpenJDK 17 by default. You can configure which version is the default using the following command:
Copy to clipboardsudo update-alternatives --config java
You can check the installation using the following command:
Copy to clipboardjava -version
Expected command output is:
1 2 3openjdk version "17.x.xx" OpenJDK Runtime Environment (...) OpenJDK 64-Bit Server VM (build ...)
Download installation package.
Copy to clipboardwget https://github.com/thingsboard/thingsboard/releases/download/v3.9/thingsboard-3.9.rpm
Install ThingsBoard as a service
Copy to clipboardsudo rpm -Uvh thingsboard-3.9.rpm
ThingsBoard is able to use SQL or hybrid database approach. See corresponding architecture page for more details.
PostgreSQL(recommended for < 5K msg/sec)
Hybrid
PostgreSQL+Cassandra
(recommended for > 5K msg/sec)
ThingsBoard team recommends to use Hybrid database approach if you do plan to have 1M+ devices in production or high data ingestion rate (> 5000 msg/sec). In this case, ThingsBoard will be storing timeseries data in Cassandra while continue to use PostgreSQL for main entities (devices/assets/dashboards/customers). PostgreSQL InstallationInstructions listed below will help you to install PostgreSQL. Copy to clipboard1 2# Update your systemsudo dnf update Install the repository. For CentOS/RHEL 8: Copy to clipboard1 2# Install the repository RPM:sudo dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm For CentOS/RHEL 9: Copy to clipboard1 2# Install the repository RPM:sudo dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm Install the package. Copy to clipboard1 2 3 4 5 6 7 8# Install packagessudo dnf -qy module disable postgresqlsudo dnf -y install postgresql16 postgresql16-server postgresql16-contrib# Initialize your PostgreSQL DBsudo /usr/pgsql-16/bin/postgresql-16-setup initdbsudo systemctl start postgresql-16# Optional: Configure PostgreSQL to start on bootsudo systemctl enable --now postgresql-16 Once PostgreSQL is installed, you may want to create a new user or set the password for the main user. The following instructions will help you to set the password for the main PostgreSQL user. To switch your current user context to the postgres user, execute the following script: Copy to clipboardsudo su - postgres To interact with the PostgreSQL database, enter: Copy to clipboardpsql You will connect to the database as the main PostgreSQL user. To set the password, enter the following command after postgres=# : Copy to clipboard\password Enter and confirm the password. Then, press “Ctrl+D” to return to the main user console. After configuring the password, connect to the database to create thingsboard DB: Copy to clipboardpsql -U postgres -d postgres -h 127.0.0.1 -W Execute create database statement Copy to clipboardCREATE DATABASE thingsboard; Then, press “Ctrl+D” twice to exit PostgreSQL. Cassandra InstallationPlease follow official Apache Cassandra installation guide. You can use Astra DB cloud instead installing your own Cassandra. See how to connect ThingsBoard to Astra DB ThingsBoard ConfigurationEdit ThingsBoard configuration file Copy to clipboardsudo 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: Copy to clipboard1 2 3 4 5# DB Configuration export DATABASE_TS_TYPE=cassandraexport SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/thingsboardexport SPRING_DATASOURCE_USERNAME=postgresexport SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HERE You can optionally add the following parameters to reconfigure your ThingsBoard instance to connect to external Cassandra nodes: Copy to clipboard1 2 3 4 5 6export CASSANDRA_CLUSTER_NAME=Thingsboard Clusterexport CASSANDRA_KEYSPACE_NAME=thingsboardexport CASSANDRA_URL=127.0.0.1:9042export CASSANDRA_USE_CREDENTIALS=false export CASSANDRA_USERNAME=export CASSANDRA_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.
Confluent Cloud is a fully managed streaming platform based on Kafka. Useful for a cloud agnostic deployments.
See corresponding architecture page and rule engine page for more details.
In Memory(built-in and default)
Kafka(recommended for on-prem, production installations)
AWS SQS(managed service from AWS)
Google Pub/Sub(managed service from Google)
Azure Service Bus(managed service from Azure)
RabbitMQ(for small on-prem installations)
Confluent Cloud(Event Streaming Platform based on Kafka)
In Memory queue is built in and enabled by default. No additional configuration is required. |
Edit ThingsBoard configuration file
Copy to clipboardsudo nano /etc/thingsboard/conf/thingsboard.conf
Add the following lines to the configuration file.
Copy to clipboard1 2# Update ThingsBoard memory usage and restrict it to 2G in /etc/thingsboard/conf/thingsboard.confexport JAVA_OPTS="$JAVA_OPTS -Xms2G -Xmx2G"
We recommend adjusting these parameters depending on your server resources. It should be set to at least 2G (gigabytes), and increased accordingly if there is additional RAM space available. Usually, you need to set it to 1/2 of your total RAM if you do not run any other memory-intensive processes (e.g. Cassandra), or to 1/3 otherwise.
Once ThingsBoard service is installed and DB configuration is updated, you can execute the following script:
Copy to clipboard1 2# --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:
Copy to clipboard1 2sudo firewall-cmd --zone=public --add-port=8080/tcp --permanentsudo firewall-cmd --reload
Execute the following command to start ThingsBoard:
Copy to clipboardsudo service thingsboard start
Once started, you will be able to open Web UI using the following link:
Copy to clipboardhttp://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.
Please allow up to 90 seconds for the Web UI to start.
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:
Copy to clipboard/var/log/thingsboard
You can issue the following command in order to check if there are any errors on the backend side:
Copy to clipboardcat /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 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.
上一篇:没有了
下一篇:没有了