Installing Mosquitto on Ubuntu 14.04

Here's a log of my experience installing Mosquitto server on Ubuntu 14.04. Mostly, I followed the excellent walkthrough on the OwnTracks Broker page, with a few adjustments along the way.

First, the errors/issues:

  • I started out right away with an apt-get install mosquitto mosquitto-clients, and while that worked, the version in the Ubuntu repositories was lacking a number of features. For one thing, I couldn't the run mosquitto_passwd command at all...the command couldn't be found on my system.
  • I ended up visiting the mosquitto repositories online to figure out which version I actually needed for my system and downloading directly. The 'awk' command listd on the OwnTracks Broker page downloaded html content, and not a repository list

Get the repository key:

curl -O

Add the new key to my system:

sudo apt-key add mosquitto-repo.gpg.key

Remove the downloaded key file

rm mosquitto-repo.gpg.key

Switch to my machine's sources list folder:

cd /etc/apt/sources.list.d/

This didn't work for me:

sudo curl -O$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release).list

Instead, I visited with a browser and found that was the file I wanted. So this worked:

sudo curl -O

Then, update and install:

apt-get update && apt-get install mosquitto mosquitto-clients

Now, users can be added to a custom password file (remove the "-c" for additional users, or it will overwrite the file:

sudo mosquitto_passwd -c /etc/mosquitto/passwd [user]


2015-12-31, 10:12 am