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 ,thingsboard.deb 的来源有三个, 一个是官方的,一个是你在ubuntu 下边打包,最后一种是在windows 下边打包的,打包生成的文件在thingsboard\application\target 下边 , 前两种直接安装就行,最后一种如果要安装到Ubuntu 需要在dpkg -i 安装之后将thingsboard 相关文档给传换成unix 格式,主要是install.sh  thingsboard.yml,thingsboard.conf. 为了转换的彻底, 可以采用find  /usr/share/thingsboard | xargs dos2unix ,(改方法是China Thingsboard 群  网友---北京-Felix  提供)然后再执行install.sh.   注意: 如果没有dos2unix 命令, 直接先 apt-get install dos2unix 安装 然后再执行前述命令即可。
  • 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,    

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值