Install Mosquitto MQTT Broker
Tested VersionsMyController tested on Mosquitto 1.6.9
Mosquitto broker can be installed in different way. Here we are focusing to setup it on docker and Mosquitto 1.6.9 version.
To install Mosquitto broker on your host system follow this guide
NoteAssuming that you are running all the commands as a
If you are running from non-root user, you should include
sudoin the beginning of the commands.
Detailed information is on Mosquitto Website
# create mosquitto.conf mkdir -p /opt/apps/mosquitto cd /opt/apps/mosquitto cat << EOF > mosquitto.conf allow_anonymous true persistence false persistence_location /mosquitto/data/ EOF
Print Working Directory.
mkdir -p /opt/apps/mosquitto cd /opt/apps/mosquitto docker run -d --name mc_mosquitto \ --publish 1883:1883 \ --publish 9001:9001 \ --volume $PWD/mosquitto.conf:/mosquitto/config/mosquitto.conf \ --restart unless-stopped \ eclipse-mosquitto:1.6.9
To see the logs
- Prints all available logs
docker logs mc_mosquitto
- Prints and tails the logs, to get exit do
docker logs --follow mc_mosquitto
docker restart mc_mosquitto
docker stop mc_mosquitto docker rm mc_mosquitto
Was this page helpful?