Running your MQTT broker
In this section, you will learn how to install Mosquitto in Debian systems such as Ubuntu or Raspberry Pi.
As usual, you should update the packages, as follows:
$ sudo apt-get update && sudo apt-get upgrade -y
After that, you can install the Mosquitto broker and client from the packages:
$ sudo apt-get install mosquitto mosquitto-clients
Once you have installed Mosquitto, you can configure it according to your needs.
The main configuration file of Mosquitto is in the /etc/mosquitto/
and /etc/mosquitto/conf.d
directories.
Looking into mosquitto.conf
, you will see something like this:
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc...