服务器是Centos,mosquitto版本是1.6.12
mosquitto 是上家公司用的中间件,支持mqttV3协议,标准的物联网mq
mosquitto 下载地址http://mosquitto.org/download/

  1. 下载mosquitto tar.gz包
  2. 安装依赖
yum install gcc-c++
yum install cmake
yum install openssl-devel 
  1. tar -zxvf mosquitto-xxxx

  2. cd mosquitto-xxxx

  3. make

  4. sudo make install

  5. 修改conf
    a. allow_anonymous false
    b. password_file
    image.png

  6. 在对应路径/data下创建文件
    touch mqpwdfile

  7. 为mq增加帐号密码。直接写到这个mqpwdfile没卵用的

mosquitto_passwd -c mqpwdfile 用户名
Password: 

重复两次密码
  1. image.png

  2. 启动mosquitto

mosquitto -c /data/mosquitto-1.6.12/mosquitto.conf -d
  1. ps -ef |grep mosquitto
    image.png

  2. mqtt.fx连接成功
    image.png