Question

Installing mosquitto on 20.04

I want to install mosquitto on Ubuntu 20.04, but Digital Ocean only has a tutorial for doing this under 18.04. Is the proceedure the exact sme for 20.04? I’m asking because I couldn’t complete the install without running into an error when trying to restart mosquitto.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi,

Installation and configuration procedure described in tutorial for Ubuntu 18.04 is suitable for Ubuntu 20.04 as well. However, keep in mind that Mosquitto has evolved since the tutorial was published. There are some improvements/changes in its configuration. For example, since ver. 1.5 you can differentiate some settings per listener. I recommend taking a look at a manual of the version you are using by typing in your command line:

man mosquitto.conf

To troubleshoot the problem check Mosquitto’s log which (by default) is located due to configuration in /etc/mosquitto/mosquitto.conf

/etc/mosquitto/mosquitto.conf
...
log_dest file /var/log/mosquitto/mosquitto.log
...

Due to above settings, display last 100 lines of the log file:

sudo tail -100 /var/log/mosquitto/mosquitto.log

…and check what is going there.

As the error may be related to some mistake made in config file, I am giving a portion of my config for reference:

/etc/mosquitto/conf.d/default.conf
per_listener_settings false
  
allow_anonymous false
password_file /etc/mosquitto/passwd

listener 1883 localhost

listener 8883
cafile /etc/letsencrypt/live/mydomain.what/chain.pem
certfile /etc/letsencrypt/live/mydomain.what/cert.pem
keyfile /etc/letsencrypt/live/mydomain.what/privkey.pem

Let me know how it works, pls.

Hello @N4TTY ,

There should not be any major difference in the tutorial for Ubuntu 20.04 I recommend following https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-20-04 to setup Ubuntu 20.04 and then https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-the-mosquitto-mqtt-messaging-broker-on-ubuntu-18-04 to install Mosquitto.

Let us know if you are stuck at any point.

Cheers, Lalitha