Mosquitto安装、测试
1、官网下载安装包,并上传到服务器
下载地址:http://mosquitto.org/download/
上传服务器,并解压:

2、进入解压完的目录:

3、安装依赖库
命令:yum install -y c-ares-devel e2fsprogs-devel uuid-devel libuuid-devel

4、默认安装是默认情况下mosquitto的安装需要OpenSSL(一个强大的安全套接字层密码库)的支持,若不需要SSL,则需要关闭config.mk里面与SSL功能有关的选项(WITH_TLS、WITH_TLS_PSK),注销即可
5、进行编译安装
命令:make && make install

完成后

6、配置mosquitto

将mosquitto.conf.example 复制一份为mosquitto.conf

7、安装完成后,系统命令中会出现

8、启动:
密令:mosquitto -c /etc/mosquitto/mosquitto.conf -d

启动可能遇到的问题:

解决办法:

或
执行命令:adduser mosquitto
9、测试
9.1 订阅
订阅格式:mosquitto_sub -t 主题
mosquitto_sub -t mqtt

9.2 发布
发布格式:mosquitto_pub -t 主题 -i 发布端 -h 主机 -m 你好
mosquitto_pub -h localhost -t mqtt -m "hello world."

随后订阅处会出现

到此测试及安装完成
相关推荐
LandryBean 2020-06-14
昭君出塞 2019-12-27
yangyouth 2019-06-30
HTKLPXH 2019-06-28
scmrpu 2019-06-28
lovelily 2016-10-25
周海汉的开发 2016-03-03
HowIMetYourDad 2018-01-13
安在信息安全新媒体 2017-12-13