Searching the knowledge base
Mosquitto MQTT Broker
Installing Mosquitto MQTT Broker
Mosquitto is a lightweight and open source MQTT Broker. Eclipse Mosquitto is part of the of the Eclipse IoT project. The Broker currently supports the versions 5.0, 3.1.1, and 3.1 of the MQTT protocol. Furthermore, the package comes with two utilities: mosquitto_pub and mosquitto_sub for publishing and subscribing.
apt-get install mosquitto
apt-get install mosquitto-clients
This installs the mosquitto Broker as a service and the mqtt-client to communicate with.
service mosquitto status
● mosquitto.service - Mosquitto MQTT v3.1/v3.1.1 Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-10-06 12:52:23 CEST; 6min ago
Docs: man:mosquitto.conf(5)
man:mosquitto(8)
Main PID: 14737 (mosquitto)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/mosquitto.service
└─14737 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Okt 06 12:52:23 NG-dca63298e6a5 systemd[1]: Starting Mosquitto MQTT v3.1/v3.1.1 Broker...
Okt 06 12:52:23 NG-dca63298e6a5 systemd[1]: Started Mosquitto MQTT v3.1/v3.1.1 Broker.
To test this, we have to open two terminal windows. In one window, we subscribe for a specific topic (“/test/topic”), in the other we publish a message to this topic.
