$ sudo docker run hello-world
### 2.2 ubuntu22 安装docker
$ sudo apt remove docker docker-engine docker &&
sudo apt update &&
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common &&
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - &&
sudo add-apt-repository “deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable” &&
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7EA0A9C3F273FCD8
$ sudo apt update
$ sudo apt install docker-ce docker-ce-cli containerd.io
$ sudo systemctl status docker
$ sudo systemctl restart docker
$ sudo docker run hello-world
![](/zb_users/upload/2024/csdn/877943ea413d4d7cb8de7334126b93da.png) ## 3. ubuntu22初始化thingsboard
mkdir -p ~/.mytb-data && sudo chown -R 799:799 ~/.mytb-data &&
mkdir -p ~/.mytb-logs && sudo chown -R 799:799 ~/.mytb-logs
运行:
docker run -itd -p 18080:9090 -p 7070:7070 -p 1883:1883 -p 5683-5688:5683-5688/udp -v ~/.mytb-data:/data
-v ~/.mytb-logs:/var/log/thingsboard --name mytb --restart always thingsboard/tb-postgres
配置frp
wget https://github.com/fatedier/frp/releases/download/v0.51.3/frp_0.51.3_linux_amd64.tar.gz
tar -zvxf frp_0.51.3_linux_amd64.tar.gz
cd frp_0.51.3_linux_amd64
gedit frpc_aws.ini
输入以下内容:
serverAddr = “54.195.159.170”
serverPort = 30000
auth.method = “token”
auth.token = “520101”
[[proxies]]
name = “tcp1”
type = “tcp”
localIP = “127.0.0.1”
localPort = 18080
remotePort = 30002
[[proxies]]
name = “web1”
type = “tcp”
localIP = “127.0.0.1”
localPort = 1883
remotePort = 30003
运行
./frpc -c frpc_aws.ini &
## 4. 登录测试 浏览器打开:54.195.159.170:30002 默认账号:
System Administrator: sysadmin@thingsboard.org / sysadmin
Tenant Administrator: tenant@thingsboard.org / tenant
Customer User: customer@thingsboard.org / customer
![](/zb_users/upload/2024/csdn/93aa7d0b30b547acbe3c44cc4df51760.png) ![](/zb_users/upload/2024/csdn/bd02ccafbea5400c8114f478e3cdedee.png) ## 5. 设备相关操作 以租户管理员登录thingsboard Tenant Administrator: tenant@thingsboard.org / tenant ### 5.1 新建设备 -> 实体 -> 设备 -> 添加设备 -> 添加设备 -> -> 名称:My New Device -> 添加 ![](/zb_users/upload/2024/csdn/2c1d7c10c048404d84ca833abfdbdbb0.png) ### 5.2 设备上传信息 用mqtt.fx调试: IP: 192.168.125.146 port: 1883 client id: 1234 UserName: FBXGO4WNt8u1E5UwJD2E 发送主题: v1/devices/me/telemetry 发送内容: {temperature:25.2} ![](/zb_users/upload/2024/csdn/8e765e60e216427c9d369044b6d59571.png) ![](/zb_users/upload/2024/csdn/7a72eb87e3b8407bac3045845047a6b1.png) ![](/zb_users/upload/2024/csdn/1ed8369df97443b2941636cacc790387.png) 用postman调试: postman -> file -> import:
curl -v -X POST http://54.195.159.170:30002/api/v1/FBXGO4WNt8u1E5UwJD2E/telemetry --header Content-Type:application/json --data “{temperature:26}”
![](/zb_users/upload/2024/csdn/314668511edc469eab2179bf79d70342.png) ![](/zb_users/upload/2024/csdn/c5edc5b2474349dca3e2c59afcbc65f7.png) ### 5.3 向设备下发消息 用mqtt.fx调试: 订阅主题: v1/devices/me/attributes -> 实体 -> 设备 -> My New Device -> 属性 -> 客户端属性 -> 添加或修改 键名:test,数值:1236 接收到内容: {test: 1236} ![](/zb_users/upload/2024/csdn/c5807b84ebef4b34baa90af1be92d1cd.png) ![](/zb_users/upload/2024/csdn/5626ded7bcb248eda3661077244ce272.png) ### 5.4 http调试 用mqtt.fx调试: IP: 54.195.159.170 port: 30003 client id: 1234 UserName: FBXGO4WNt8u1E5UwJD2E 发送主题: v1/devices/me/attributes 发送内容: {"attribute1": "value2", "attribute2": true} 用curl调试: 修改:
curl -v -X POST --data “{“attribute1”: “value2”, “attribute2”:true, “attribute3”: 43.0}” http://54.195.159.170:30002/api/v1/FBXGO4WNt8u1E5UwJD2E/attributes --header “Content-Type:application/json”
![](/zb_users/upload/2024/csdn/19ea67e334e0478fb35bfa60fc366282.png) ![](/zb_users/upload/2024/csdn/4f757f22c3ca4bbabf27a48c250cc179.png) 获取:
curl -v -X GET “http://54.195.159.170:30002/api/v1/FBXGO4WNt8u1E5UwJD2E/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2”
可以得到{"client":{"attribute2":true,"attribute1":"value2"}} ![](/zb_users/upload/2024/csdn/b56a608e1fc2406fbf32a0a5b1f1f5a9.png) ## 6. 数据可视化 仪表板 -> 添加仪表板 -> 标题:New Dashboard ![](/zb_users/upload/2024/csdn/811565f57af34001b983de2bf1edcc3f.png) -> 添加部件 -> Cards -> Value card -> 设备: My New Device -> Value: decimals 1 -> 添加 ![](/zb_users/upload/2024/csdn/17e2f63cf11c468998cb24fbd2850964.png) ## 7. 告警 ### 7.1 添加仪表板 仪表板 -> 选择仪表板:New Dashboard -> Edit mode -> 添加部件 -> Alarm widgets -> Alarm table -> 设备: My New Device -> 添加 -> 保存 ## 最后 **自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。** **深知大多数Java工程师,想要提升技能,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。** **因此收集整理了一份《2024年嵌入式&物联网开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。** ![img](/zb_users/upload/2024/csdn/e7c1ddf303a5d1de4a53e0a0ad1cbdb8.png) ![img](/zb_users/upload/2024/csdn/40472b99776e4633d6df1f8dde588ef2.jpeg) ![img](/zb_users/upload/2024/csdn/856972e4d32a1fbd939196793630a932.png) ![img](/zb_users/upload/2024/csdn/6b7880d9821d18fba0d68f547c6df33d.png) ![img](/zb_users/upload/2024/csdn/4ba1efc1cd572ee3022b84ca1948b950.png) ![img](/zb_users/upload/2024/csdn/7ee32c5f4849db92f7a1950321a6c251.png) ![](/zb_users/upload/2024/csdn/f87cac51794ccd4a701ebf62502be452.png) **既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上嵌入式&物联网开发知识点,真正体系化!** [**如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!**](https://bbs.csdn.net/topics/618654289) **由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新**!! ...(img-NdukNtNs-1715605757849)] **既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上嵌入式&物联网开发知识点,真正体系化!** [**如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!**](https://bbs.csdn.net/topics/618654289) **由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新**!!