项目

一般

简介

Ubuntu安装mqtt服务

  1. 安装
    apt install mosquitto
    
  2. 修改监听端口和IP
    vim /etc/mosquitto/mosquitto.conf
    listener 1883 0.0.0.0
    
  3. 设置用户名密码
    cp /etc/mosquitto/pwfile.example /etc/mosquitto/pwfile
    mosquitto_passwd -c /etc/mosquitto/pwfile test
    test123
    

    注:不设置用户名密码,可能报错:Client <unknown> disconnected, not authorised.
  4. 重启服务
    systemctl restart mosquitto