Right now I have 1.3.4 Mosquitto Version installed from the repository on my PI. Current version is 1.4.15. So, how do I go about upgrading my Mosquitto MQTT to the latest version on my PI? I looked around on the Internet, but I can't seem to really find any information. I also checked the PI's repository and it only has 1.3 version. Any help will be appreciated. Thanks.
2 Answers
I'm guessing you're running Raspbian Jessie, which only has Mosquitto 1.3.4 in the repositories. Raspbian Stretch does indeed have a more recent version — 1.4.10.
If this would be sufficient, you can just flash a new Raspbian Stretch image on to your SD card and install Mosquitto. Note that the Pi Foundation suggest using a new image rather than upgrading with your package manager, although that may work despite the warnings. Be aware that flashing a new image will of course delete all of your files.
Otherwise, you may need to build the latest version from source:
Building from source
To build from source the recommended route for end users is to download the archive from http://mosquitto.org/download/.
On Windows and Mac, use
cmaketo build. On other platforms, just runmaketo build. For Windows, see also readme-windows.md.If you are building from the git repository then the documentation will not already be built. Use make binary to skip building the man pages, or install docbook-xsl on Debian/Ubuntu systems.
Build Dependencies
- c-ares (libc-ares-dev on Debian based systems) - disable with make WITH_SRV=no
- libuuid (uuid-dev) - disable with make WITH_UUID=no
- libwebsockets (libwebsockets-dev) - enable with make WITH_WEBSOCKETS=yes
- openssl (libssl-dev on Debian based systems) - disable with make WITH_TLS=no
- xsltproc (xsltproc and docbook-xsl on Debian based systems) - only needed when building from git sources - disable with make WITH_DOCS=no
It doesn't look like Mosquitto is available from the backports repository, so you're limited to compiling it yourself, I would think.
- 6,357
- 3
- 25
- 39
I searched online high and low and came across this webpage on Mosquitto.org website. Link to where I found information on upgrading Mosquitto
I am going to post what I found and how I upgraded mosquitto in case that webpage disappears. Do the following.
To use the new repository you should first import the repository package signing key:
wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
sudo apt-key add mosquitto-repo.gpg.key
Then make the repository available to apt:
cd /etc/apt/sources.list.d/
Then one of the following, depending on which version of debian you are using:
sudo wget http://repo.mosquitto.org/debian/mosquitto-wheezy.list
sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list
sudo wget http://repo.mosquitto.org/debian/mosquitto-stretch.list
Then update apt information:
sudo apt-get update
And discover what mosquitto packages are available:
sudo apt-cache search mosquitto
Or just install or upgrade:
sudo apt-get install mosquitto
Finally install the Mosquitto Clients:
sudo apt-get install mosquitto-clients
This worked for me. The reason I wanted to upgrade to the latest Mosquitto MQTT was because I having problems and issues running Mosquitto 1.3. Clients kept loosing connection to the broker. Hopefully, this upgrade fixes that. Thank for your help.