mosquitto

apt

sudo apt-get update
sudo apt-get install mosquitto

Configure

Modify the /etc/mosquitto/mosquitto.conf file, the content is as follows

# 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 /run/mosquitto/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d

allow_anonymous true

port 1883

Test

../_images/connect-mqtt.png ../_images/subscribe-topic.png ../_images/push-message.png ../_images/recv-message.png