物联网IOT平台之ThingsBoard学习笔记(一)——CentOS安装部署ThingsBoard

CentOS部署ThingsBoard

  • ThingsBoard是什么?
  • 安装流程
    • ThingsBoard安装
    • PostgreSQL Installation
  • 参考文档
  • 加入我们

ThingsBoard是什么?

开源的物联网平台;
物联网解决方案的设备管理、数据收集和可视化;

安装流程

安装流程可分为两部分:第一安装thingsboard,第二安装thingsboard所需要的数据库——PostgreSQL。

ThingsBoard安装

# 查看linux版本
cat /etc/redhat-release

# 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


# 步骤1. 安装Java 8(OpenJDK)
sudo yum install java-1.8.0-openjdk

# 配置哪个版本是默认版本:
sudo update-alternatives --config java

java -version

# 步骤2. 安装服务
# 下载安装包。
wget https://github.com/thingsboard/thingsboard/releases/download/v3.1.1/thingsboard-3.1.1.rpm

# 安装服务
sudo rpm -Uvh thingsboard-3.1.1.rpm

PostgreSQL Installation

# Update your system
sudo yum update

# Install the repository RPM (for CentOS 7):
sudo yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# Install packages
sudo yum -y install epel-release yum-utils
sudo yum-config-manager --enable pgdg12
sudo yum install postgresql12-server postgresql12
# Initialize your PostgreSQL DB
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
sudo systemctl start postgresql-12
# Optional: Configure PostgreSQL to start on boot
sudo systemctl enable --now postgresql-12


sudo su - postgres
psql
\password
\q


sudo nano /var/lib/pgsql/12/data/pg_hba.conf


# IPv4 local connections:
host    all             all             127.0.0.1/32            ident
# Replace ident with md5:
host    all             all             127.0.0.1/32            md5

sudo systemctl restart postgresql-12.service

psql -U postgres -d postgres -h 127.0.0.1 -W

CREATE DATABASE thingsboard;
\q

sudo nano /etc/thingsboard/conf/thingsboard.conf

# DB Configuration 
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
# Specify partitioning size for timestamp key-value storage. Allowed values: DAYS, MONTHS, YEARS, INDEFINITE.
export SQL_POSTGRES_TS_KV_PARTITIONING=MONTHS


sudo nano /etc/thingsboard/conf/thingsboard.conf

# Update ThingsBoard memory usage and restrict it to 256MB in /etc/thingsboard/conf/thingsboard.conf
export JAVA_OPTS="$JAVA_OPTS -Xms256M -Xmx256M"

# --loadDemo option will load demo data: users, devices, assets, rules, widgets.
sudo /usr/share/thingsboard/bin/install/install.sh --loadDemo

sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent
sudo firewall-cmd --reload

sudo service thingsboard start

http://localhost:8080/

参考文档

官方文档
中文文档
他人博客

加入我们

物联网IOT平台之ThingsBoard学习笔记(一)——CentOS安装部署ThingsBoard_第1张图片
点击链接加入群聊【IT技术交流群1】:https://jq.qq.com/?_wv=1027&k=q4XbOSvn

你可能感兴趣的:(物联网,ThingsBoard,物联网,学习)