Ubuntu MQTT mosquitto

https://github.com/eclipse/paho.mqtt.c.git

https://github.com/eclipse/paho.mqtt.cpp.git

Paho MQTT C Client Library: MQTT Client library for C (MQTTClient)

GitHub - eclipse/mosquitto: Eclipse Mosquitto - An open source MQTT broker

  1. install:

https://mosquitto.org/download/

  1. conf:

打开/etc/mosquitto/mosquitto.conf,发现需要将配置文件放置于/etc/mosquitto/conf.d/目录下,示例文件可以从/usr/share/doc/mosquitto/examples/目录下提取,发现其是一个压缩包,将其解压缩,然后复制到/etc/mosquitto/conf.d/目录下。

xx@ubuntu:/etc/mosquitto$ cd /usr/share/doc/mosquitto/examples/

xx@ubuntu:/usr/share/doc/mosquitto/examples$ ls -lh

总用量 24K

-rw-r--r-- 1 root root 230 Apr 3 2021 aclfile.example

-rw-r--r-- 1 root root 12K Apr 3 2021 mosquitto.conf.gz

-rw-r--r-- 1 root root 23 Apr 3 2021 pskfile.example

-rw-r--r-- 1 root root 355 Apr 3 2021 pwfile.example

cd /usr/share/doc/mosquitto/examples/

sudo gzip -d mosquitto.conf.gz

sudo cp mosquitto.conf /etc/mosquitto/conf.d/

手动启动mosquitto,方便查看日志排查出现的问题。

mosquitto -c /etc/mosquitto/conf.d/mosquitto.conf -v

配置成无用户密码校验和无TLS连接

listener 1883

allow_anonymous true

配置文件如上配置,然后启动mosquito。

  1. stat:

service mosquitto status // 查看服务状态

service mosquitto start // 启动

service mosquitto stop // 停止

service mosquitto restart // 重启

  1. test:

mosquitto_sub -h "192.168.10.111" -p 1883 -t "mqtt/test" -v

mosquitto_pub -h "192.168.10.111" -p 1883 -t "mqtt/test" -m "hello"

Reference:

Ubuntu mosquitto 安装及配置-CSDN博客

ubuntu上安装mosquitto服务_mosquitto ubuntu-CSDN博客

Linux Ububtu下安装MQTT服务器_ubuntu安装mqtt-CSDN博客

相关推荐
木卯彳亍13 分钟前
番外-linux系统运行.net framework 4.0的项目
linux·docker·.net
望获linux17 分钟前
【实时Linux实战系列】硬实时与软实时设计模式
linux·运维·服务器·数据库·操作系统·rtos·嵌入式软件
沉默的八哥3 小时前
Linux中LVM逻辑卷扩容
linux·运维·服务器
退役小学生呀3 小时前
十一、K8s细粒度权限管理RBAC
linux·docker·云原生·容器·kubernetes·k8s
网易独家音乐人Mike Zhou4 小时前
【Linux应用】开发板USB共享网络,网线或USB以太网共享网络(局域网连接PC和开发板,实现PC给开发板共享网络,USB通过NDIS驱动共享)
linux·网络·单片机·mcu·物联网·嵌入式·iot
Otaku love travel5 小时前
实施运维文档
运维·windows·python
basketball6165 小时前
Linux C 管道文件操作
linux·运维·c语言
浩浩测试一下5 小时前
Windows 与 Linux 内核安全及 Metasploit/LinEnum 在渗透测试中的综合应用
linux·运维·windows·web安全·网络安全·系统安全·安全架构
stark张宇5 小时前
Linux 文件创建、删除、移动、复制基础知识整理
linux·服务器·centos
将心ONE6 小时前
使用 lstrip() 和 rstrip() 方法
运维·服务器