Ubuntu 20.04 安装 MQTT(mosquitto)
安装mosquitto borker
sudo apt-get update
sudo apt-get install mosquitto
安装mosquitto clients
sudo apt-get install mosquitto-clients
查看运行状态
systemctl status mosquitto
状态信息:
mosquitto.service - Mosquitto MQTT v3.1/v3.1.1 Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor pre>
Active: active (running) since Mon 2022-05-09 16:59:13 CST; 16h ago
Docs: man:mosquitto.conf(5)
man:mosquitto(8)
Main PID: 524488 (mosquitto)
Tasks: 3 (limit: 18708)
Memory: 1.2M
CGroup: /system.slice/mosquitto.service
└─524488 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
重启mqtt服务
systemctl restart mosquitto
停止mqtt服务
systemctl stop mosquitto
测试使用mqtt
mosquitto -v
1652145455: mosquitto version 1.6.9 starting
1652145455: Using default config.
1652145455: Opening ipv4 listen socket on port 1883.
1652145455: Opening ipv6 listen socket on port 1883.
启动mosquitto监听1883端口
mosquitto -p 1883
启动mosquitto后台运行监听1884端口
mosquitto -p 1884 -d
**启动mosquitto后台运行使用mosquitti-2.conf配置文件
mosquitto -c /etc/mosquitto/mosquitto-2.conf -d
本文链接地址:https://const.net.cn/701.html