thingsboard 在云服务器 ubuntu 14.04 上的安装和启动
- 概述: 总结起来就是安装java 8环境、安装数据库、安装maven, 安装thingsboard.deb ,配置数据库,启动thingsboard, 配置云服务器的安全组,开放8080端口。看实际情况是否需要关闭防火墙,sudo ufw status。sudo ufw disable/enable. 下边就详细说说:
- 1 JDK 安装
首先是安装jdk, 一般有两个方法, 一个是添加源; 另一个安装pkg包。试了很多方法,可能版本不对,遭遇很多坑还把PATH环境搞乱掉,最后重装了一下。这里边推荐第一种靠谱的方法;
1). 添加openjdk8的第三方源
sudo add-apt-repository ppa:openjdk-r/ppa
2). 执行更新
apt-get update
3). 安装openjdk8
sudo apt-get install openjdk-8-jdk
4). 选择版本
sudo update-alternatives –config Java
5). 确认安装成功
java -version
具体见 :https://blog.csdn.net/wukery/article/details/79467468
- 2安装 thingsboard dpkg -i thingsboard.deb
- 3安装数据库:Postgres
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
sudo service postgresql start
- 4数据库配置,
就是登陆sql 数据库,创建一个空数据库,然后配置一下thingsboard 的配置,指示他要用的数据库和密码,类似于于net core asp 的connectionString. 程序也提供了Demo数据,在安装TB的时候可以加上这个参数,这样数据库里边就有了演示数据。所谓演示数据就是提前预置的账户、设备、部件等信息。下面来看一下具体步骤:也可参照官网:https://thingsboard.io/docs/user-guide/install/ubuntu/
Instructions listed below will help you to install PostgreSQL.
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
sudo service postgresql start
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
sudo su - postgres
psql
\password
\q
Then, press “Ctrl+D” to return to main user console and connect to the database to create thingsboard 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 lines 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
-
5安装服务
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
-
6启动
Start ThingsBoard service
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:
ubuntu 内网访问 : http://localhost:8080/ , 如果是远程计算机访问云上边的就 http:远程ip:8080.
此种情况是没有域名的情况, 如果有域名急用域名访问。
如果需要安装maven , sudo apt-get install maven,