Mosquitto#
Mosquitto is a lightweight open source (EPL/EDL licensed) message broker that implements the MQTT protocol. Refer to the Mosquitto site for more details.
Set Up the Mosquitto Connection#
Linux Environment#
Install Mosquitto, using the command -->
sudo apt install Mosquitto
.Copy file from https://github.com/eclipse/Mosquitto/blob/master/Mosquitto.conf and paste in linux machine.
Open the Mosquitto.conf file and include password_file (Mosquitto.pwd) in General configuration.
The password file contains the username and password in hashed format. To create your own username and password for Mosquitto, use the following link.
In the Listeners section, change listener to
<port no.> <ip address of linux machine>
.In the same section, find #protocol mqtt and uncomment it.
Follow Openssl Certificate Creation to create certificates.
Provide the required certificates path in the “Certificate based SSL/TLS support” and, in the same section, set the flag require_certification to
true
.In Security section, uncomment the flag
allow_anonymous
false.Now that your configuration file is set, save it and run the following command in terminal to run Mosquitto:
Mosquitto -v -c Mosquitto.conf
Windows Environment#
Install Mosquitto using the mosquitto download.
Open the Mosquitto.conf file and include password_file (Mosquitto.pwd) in General configuration.
The password file contains the username and password in hashed format. To create your own username and password for Mosquitto, use the following link.
In the Listeners section, change listener to
<port no.> <ip address of linux machine>
.In the same section, find #protocol mqtt and uncomment it.
Follow Openssl Certificate Creation to create certificates.
Provide the required certificates path in Certificate based SSL/TLS support and, in the same section, set the flag require_certification to
true
.In the Security section, uncomment the flag
allow_anonymous
false.Now that your configuration file is set, save it and run the following command in terminal(command prompt) to run Mosquitto:
Mosquitto -v -c Mosquitto.conf