• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » How to Install Mosquitto MQTT on Ubuntu Server

By Abhishek Ghosh November 28, 2022 8:30 am Updated on November 28, 2022

How to Install Mosquitto MQTT on Ubuntu Server

Advertisement

We have already informed our readers that IBM Watson IoT platform will be discontinued sooner. We will gradually port our snippets for ESP32/Arduino to a generic MQTT platform to avoid this kind of issue in future.

As a user of the Watson IoT Platform (or as a new user) you need to know only two things to run on your server – Mosquitto and Node-RED. Thankfully a lot of work was done by IBM for MQTT. As we will use the server for production/final thing, we need to use a sub-domain, configure DNS and install a cert bot. Instead of Raspberry Pi, we are using the server:

How to Install Mosquitto MQTT on Ubuntu Server

Issue the following commands to get started :

Advertisement

---

Vim
1
2
3
4
5
6
7
8
9
10
apt update -y && apt upgrade -y
sudo add-apt-repository ppa:certbot/certbot
sudo apt install certbot mosquitto mosquitto-clients
# if ufw is installed then run these commands
sudo ufw allow 80
sudo ufw allow 8883
sudo ufw allow 8083
sudo ufw allow 1880
# change the domain name
sudo certbot certonly --standalone --preferred-challenges http -d mqtt.example.com

I guess, you can follow the instructions to complete the certbot installation. Point DNS towards the server. Make sure that the name resolves. It may take 12 hours to 2 days to complete propagation (depending upon your location).

Proceed with the installation and configure Mosquitto MQTT :

Vim
1
2
3
sudo mosquitto_passwd -c /etc/mosquitto/passwd your-username
# enter password
nano /etc/mosquitto/conf.d/default.conf

Use this kind of configuration :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
allow_anonymousfalse
password_file /etc/mosquitto/passwd
 
listener 1883 localhost
 
listener 8883
certfile /etc/letsencrypt/live/mqtt.example.com/cert.pem
cafile /etc/letsencrypt/live/mqtt.example.com/chain.pem
keyfile /etc/letsencrypt/live/mqtt.example.com/privkey.pem
 
listener 8083
protocol websockets
certfile /etc/letsencrypt/live/mqtt.example.com/cert.pem
cafile /etc/letsencrypt/live/mqtt.example.com/chain.pem
keyfile /etc/letsencrypt/live/mqtt.example.com/privkey.pem

Restart the service, check it and set certificate renewal:

Vim
1
2
3
4
5
6
7
8
9
systemctl restart mosquitto
systemctl status mosquitto
tail /var/log/mosquitto/mosquitto.log
 
nano /etc/letsencrypt/renewal/mqtt.example.com.conf
# add it
renew_hook = systemctl restart mosquitto
# check for errors
certbot renew --dry-run

Next, install the Paho javascript client or an Android app to check whether MQTT is working. Now install Node-RED:

Vim
1
2
3
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
# wait till installation completes
node-red admin init

Visit mqtt.example.com:1880 in a web browser to open and log in to the Node-RED admin panel. The above things were used on the IBM Watson IoT platform.

This Article Has Been Shared 637 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How to Install Mosquitto MQTT on Ubuntu Server

  • Wearables and Internet of Things : Part II

    In this part, we have discussed the basics on Internet of Things and the communication protocols used in conjuction of current wearable technology.

  • Getting Started With IBM Cloud IoT (Watson IoT Platform)

    Here is How To Get Started With IBM Cloud IoT (Watson IoT Platform). We Provided the Basic Idea of What Watson IoT Platform Does And What to Expect.

  • What is Mongoose OS? How it Works With Different IoT Cloud?

    What is Mongoose OS? Mongoose OS is not an OS per-se but a user space. It is a Firmware Development Framework for the IOT, supporting ESP32.

  • Cloud Based SMS vs Push Notifications for IoT

    A Brief Article on Cloud Based SMS vs Push Notifications for IoT Will Help the Developers to Choose Between Two Options With Maximum Delivery Rate.

  • How to Connect Apache Kafka With MQTT

    We Can Connect Apache Kafka With MQTT in Different Ways With Different Types of Available Connectors, Including Connectors Based on REST API.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What is Voice User Interface (VUI) January 31, 2023
  • Proxy Server: Design Pattern in Programming January 30, 2023
  • Cyberpunk Aesthetics: What’s in it Special January 27, 2023
  • How to Do Electrical Layout Plan for Adding Smart Switches January 26, 2023
  • What is a Data Mesh? January 25, 2023

About This Article

Cite this article as: Abhishek Ghosh, "How to Install Mosquitto MQTT on Ubuntu Server," in The Customize Windows, November 28, 2022, February 2, 2023, https://thecustomizewindows.com/2022/11/how-to-install-mosquitto-mqtt-on-ubuntu-server/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT