Install Message Queue Mosquitto on Ubuntu/Debian
MQTT is an instant messaging protocol developed by IBM. MQTT is a connection protocol for M2M and Iot. It uses a lightweight publishing and subscription message transmission mechanism. Mosquitto is an open-source message proxy software that implements MQTT v3.1 protocol. It provides a lightweight message push mode that supports publishing/subscription, making short message communication between devices easy to use.
If you contact the MQTT Protocol for the first time, you can understand the following concepts:
[MQTT protocol features]-compared with the RESTful Iot system, MQTT can achieve better remote control through message pushing.
MQTT role: An Iot system in a RESTful architecture, which contains two roles: client and server. The MQTT protocol includes publishers, proxies (servers), and subscribers.
MQTT message: the message in MQTT can be understood as the content (load) exchanged between the publisher and the subscriber. The message contains the specific content and can be used by the subscriber.
MQTT topic: a set of messages of the same type or similar type.
The default listening port is:
1883: MQTT, not encrypted
8883: MQTT, encrypted
8884: MQTT, encrypted, and verified by Customer Service
8080: MQTT uses WebSockets and is not encrypted.
By default, Mosquitto is placed in the kernel of the computer or in the microcontroller like Intel-Edison. Next we will explain how to install Mosquitto on the Linux download site.
Install MQTT:
Update source,
$ Sudo wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
$ Sudo apt-key add mosquitto-repo.gpg.key
Make source, use apt:
$ Sudo cd/etc/apt/sources. list. d/
Select the debian version as follows:
$ Sudo wget http://repo.mosquitto.org/debian/mosquitto-wheezy.list
$ Sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list
For Ubuntu users please use this address: https://launchpad.net /~ Mosquitto-dev/+ archive/ubuntu/mosquitto-ppa/
Update apt information:
$ Sudo apt-get update
Check the available resources of the mosquitto installation package:
$ Sudo apt-cache search mosquitto
Or directly go to the installation:
$ Sudo apt-get install mosquitto
Enable MQTT:
$ Sudo service mosquitto start
Stop MQTT:
$ Sudo service mosquitto stop
View the MQTT status:
$ Sudo service mosquitto status
View the listening port:
$ Netstat-anplt | grep 1883
You can also test,
$ Sudo mosquitto_sub-h test.mosquitto.org-t "#"-v
This article permanently updates the link address: