

Throughout this tutorial we will use a simple test topic to test our configuration changes.

How you arrange topics is up to you and your needs. They are arranged as a hierarchy, so you could have sensors/outside/temp and sensors/outside/humidity, for example. Topics are labels that you publish messages to and subscribe to.

We’ll use one of the Mosquitto clients we just installed to subscribe to a topic on our broker. sudo apt install mosquitto mosquitto-clientsīy default, Ubuntu will start the Mosquitto service after install.Now, install Mosquitto using apt install: Ubuntu 18.04 has a fairly recent version of Mosquitto in its default software repository, so we can install it from there.įirst, log in using your non-root user and update the package lists using apt update: Be sure to use the same domain configured in the previous prerequisite step. You can add systemctl restart mosquitto as a renew_hook in Step 4. You can learn how to set this up in How To Use Certbot Standalone Mode to Retrieve Let’s Encrypt SSL Certificates on Ubuntu 18.04 An auto-renewable Let’s Encrypt SSL certificate for use with your domain and Mosquitto, generated using the Certbot tool.A domain name pointed at your server, as per How to Set Up a Host Name with DigitalOcean.An Ubuntu 18.04 server with a non-root, sudo-enabled user and basic firewall set up, as detailed in this Ubuntu 18.04 server setup tutorial.Prerequisitesīefore starting this tutorial, you will need:

In this tutorial, we’ll install Mosquitto and set up our broker to use SSL to secure our password-protected MQTT communications. Mosquitto is a popular MQTT server (or broker, in MQTT parlance) that has great community support and is easy to install and configure. It is commonly used for geo-tracking fleets of vehicles, home automation, environmental sensor networks, and utility-scale data collection. MQTT is a machine-to-machine messaging protocol, designed to provide lightweight publish/subscribe communication to “Internet of Things” devices.
