How to explore using newer version of package (mosquitto) on LTS

I'm building up a test server using 20.04.3 LTS. Since the version of the mosquitto broker on this release is 1.6.9-1, I'd like to explore how much ground shaking I'd have to do to use a newer version of the mosquitto package. I note that both hirsute and impish include 2.0+ versions of mosquitto, so ideally, if there was a single line apt(-get) incantation I could just tell it to try and install the newer version.

I do see that there are some other answers for this sort of thing already, but some of them are pretty dated. So my question may be as simple as "is pinning still the only/best way to do this, and will it achieve what I want?" and "is there any other method?"


When you wnat newer version than the OS provides:

  • Find the source.
  • Install in /opt/
  • Create link to a binary.

Here is the source for 2.0.11 The tarball will have generally speaking a readme and/or install on how to proceed with the installation.

Another option: the link also provides a snap install and work well on Ubuntu. Those are sort of independent of the OS and that will also install 2.0.11

Another option: use their PPA

sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
sudo apt-get update

That will also use the latest stable version (2.0.11) and it will update from that PPA


Use the Snap package instead of the deb package: https://snapcraft.io/mosquitto

sudo snap install mosquitto

The Snap package is maintained by the Mosquitto Team, will be the latest release, and will auto-update. It does not matter which release of Ubuntu you run it on -- the same Snap works on all releases of Ubuntu.

  • Remember to uninstall the deb package, since you are not using it anymore!