Getting Started with MQTTI wanted to play around with MQTT this evening so I put together a little tutorial on how to get started using Ubuntu and Mosquitto. Installing Mosquitto Enter the following into your terminal. Remember to replace YOUR_UBUNTU_VERSION_HERE with the version of ubuntu you’re using, I was using Maverick Meerkat at the time so I replaced it with just maverick. First add the following two lines to /etc/apt/sources.list
Then we need to verify the newly added packages:
Lets update Aptitude so we have the latest packages to choose from:
And now lets install the Mosquitto server and clients:
Subscribing to a Topic
Publishing to a Topic In another terminal window execute:
You should see the text “Hello World” in the other window. To get the full effect you can install Mosquitto on your Mac usingHomebrew and then connect to your Ubuntu machine…
You should now see messages from your host sent to your local machine. You’ll probably need to open up port 1883 on your Ubuntu machine to make this actually work. I just used iptables to do so:
|