Install Ubuntu Server with MQTT broker

G’day projecteers, welcome to the first video in my Home Automation series. As I have not done too much with home automation I though I would bring you all along for the ride as we work our way through different projects and eventually incorporate them all into a complete home automation system.

So you might ask the question why I am installing a MQTT broker on my own Ubuntu server. Well I already have a virtualbox machine set up with a few dedicated virtual machines so rather than have to use a Raspberry Pi I decided to setup a Ubuntu server as another virtual machine. However if you would rather install the MQTT broker on a Raspberry Pi then Google is your friend. If you like I could do a video on it later.

I was planning to do a voice over in this video but as I have not set up any method to do it yet, I still have voiceless videos, sorry.

If you dont know what a MQTT broker is then have a quick look at my information page “What is a MQTT broker”

Basically the Mqtt broker makes it very easy for our sensors and devices to interact with each other, and with the addition of Node Red which I will show in the next Home Automation video, will make it easy to access from a web page gui.

We start with a fairly default Ubuntu Server install, however you can use other flavors with a user desktop environment if you like, for example Xubuntu or Kubuntu etc…

After installing and rebooting Ubuntu, we log back in as the created user and change to the root user with the su command, and password

We next run an update using the command #sudo apt update

You should then run the upgrade although I did not do this yet in my video with the command #sudo apt upgrade -y the “-y” will press Y automatically when asked the Yes/No question.

Then we install the MQTT broker called mosquitto with the following command #sudo apt install mosquitto and the client with #apt install mosquitto-clients

Finally we can do a couple of quick tests with #mosquitto -v which returns the version numer of the isntalled mosquitto MQTT broker and #mosquitto_sub -t “test” and if all goes well you will just get a flashing cursor on the next line with no errors. This is because our client is sitting waiting for a message to be posted by another device to this “test” topic. If a message is posted to “test” we will see it appear where the flashing cursor is. I intend to explore this further int he next video once Nodr-Red is installed.

Leave a Reply

Your email address will not be published. Required fields are marked *