Wiki source code of Listen on MQTT messages on Ubuntu
Last modified by Normann P. Nielsen on 2025/12/12 15:14
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | Install the client on Ubuntu: | ||
| 2 | |||
| 3 | |||
| 4 | {{code}} | ||
| 5 | sudo apt update | ||
| 6 | sudo apt install mosquitto-clients | ||
| 7 | {{/code}} | ||
| 8 | |||
| 9 | |||
| 10 | |||
| 11 | The client is now installed and can be stated to Listen on a [[Topic>>http://www.steves-internet-guide.com/understanding-mqtt-topics/]]: | ||
| 12 | |||
| 13 | |||
| 14 | {{code}} | ||
| 15 | mosquitto_sub -h localhost -t test | ||
| 16 | {{/code}} | ||
| 17 | |||
| 18 | or with username and password: | ||
| 19 | |||
| 20 | |||
| 21 | {{code}} | ||
| 22 | mosquitto_sub -h localhost -t test -u "sammy" -P "password" | ||
| 23 | {{/code}} | ||
| 24 | |||
| 25 | |||
| 26 | |||
| 27 | Read more on [[https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-the-mosquitto-mqtt-messaging-broker-on-ubuntu-18-04]] |