Install MQTT (Ubuntu)

Summary of what you are going to install:

  1. MQTT

Installation of MQTT is quite easy. You can easily install it via apt. After installation, MQTT will be enabled even after reboot.

Here are the steps:

Step 1 – Install Mosquito

$ sudo apt-get install mosquitto 
$ sudo apt-get install mosquitto-clients

Step 2 – Check the status of Mosquito

$ sudo service mosquitto status

Step 3 – Control Mosquito

Control mosquito service via the following commands:

$ sudo service mosquitto start
$ sudo service mosquitto stop
$ sudo service mosquitto restart
$ sudo service mosquitto status

Step 4 – Create publishers/subscribers to test Mosquito

All subscribers of a topic receive automatically all messages published to the same topic:

$ mosquitto_sub -h localhost -t livingroom
$ mosquitto_pub -h localhost -t livingroom -m "hello"

Related:

 

 

 

 

Leave a Reply