Install ThingsBoard CE on Ubuntu Server
Precondition
Step 1. Install Java 8 (OpenJDK)
The ThingsBoard service runs on Java 8. Follow this instructions to install OpenJDK 8:
sudo apt update
sudo apt install openjdk-8-jdk
Don't forget to configure the operating system to use OpenJDK 8 by default. You can configure the default version using the following commands:
sudo update-alternatives --config java
You can check the installation with the following commands:
java -version
The expected command output is:
openjdk version "1.8.0_xxx"
OpenJDK Runtime Environment (...)
OpenJDK 64-Bit Server VM (build ...)
Step 2. ThingsBoard Service Installation
Download the installation package.
wget https://github.com/thingsboard/thingsboard/releases/download/v2.4.1/thingsboard-2.4.1.deb
Install ThingsBoard as a service
sudo dpkg -i thingsboard-2.4.1.deb
Step 3. Configure the ThingsBoard database
PostgreSQL installation
The instructions listed below will help you install PostgreSQL.
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
sudo service postgresql start
After installing PostgreSQL, you may need to create a new user or set a password for the primary user. The following instructions will help set the password for the primary PostgreSQL user
sudo su - postgres
psql
\password
\q
Then press "Ctrl + D" to return to the main user console and connect to the database to create thingboard DB:
psql -U postgres -d postgres -h 127.0.0.1 -W
CREATE DATABASE thingsboard;
\q
ThingsBoard configuration
Edit ThingsBoard configuration file
sudo nano /etc/thingsboard/conf/thingsboard.conf
Add the following to the configuration file. Don't forget to replace "PUT_YOUR_POSTGRESQL_PASSWORD_HERE" with your real postgres user password:
#DB Configuration
export DATABASE_ENTITIES_TYPE=sql
export DATABASE_TS_TYPE=sql
export SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect
export SPRING_DRIVER_CLASS_NAME=org.postgresql.Driver
export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/thingsboard
export SPRING_DATASOURCE_USERNAME=postgres
export SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HERE
Step 4. [Optional] Memory Update for Slow Computers (1GB RAM)
Edit ThingsBoard configuration file
sudo nano /etc/thingsboard/conf/thingsboard.conf
Add the following to the configuration file.
export JAVA_OPTS="$JAVA_OPTS -Xms256M -Xmx256M"
Step 5. Run the installation script
After installing the ThingsBoard service and updating the database configuration, you can execute the following scripts:
sudo /usr/share/thingsboard/bin/install/install.sh --loadDemo
Step 6. Start the ThingsBoard service
Execute the following command to start ThingsBoard:
sudo service thingsboard start
After startup, you will be able to open the Web UI with the following links:
http://localhost:8080/
If - loadDemo is specified during the execution of the installation script, the following default credentials can be used:
Sysadmin@thingsboard.org/sysadmin
Tenant Administrator: tenant@thingsboard.org/tenant
Customer User: customer@thingsboard.org/customer
You can always change the password of each account in the account profile page