How To Install mosquitto on CentOS 7

In this tutorial we learn how to install mosquitto on CentOS 7. mosquitto is An Open Source MQTT v3.1/v3.1.1 Broker

Introduction

In this tutorial we learn how to install mosquitto on CentOS 7.

What is mosquitto

Mosquitto is an open source message broker that implements the MQ Telemetry Transport protocol version 3.1 and 3.1.1 MQTT provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for “machine to machine” messaging such as with low power sensors or mobile devices such as phones, embedded computers or micro-controllers like the Arduino.

We can use yum or dnf to install mosquitto on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install mosquitto.

Install mosquitto on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install mosquitto using yum by running the following command:

sudo yum -y install mosquitto

Install mosquitto on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install mosquitto using dnf by running the following command:

sudo dnf -y install mosquitto

How To Uninstall mosquitto on CentOS 7

To uninstall only the mosquitto package we can use the following command:

sudo dnf remove mosquitto

References

Summary

In this tutorial we learn how to install mosquitto on CentOS 7 using yum and dnf.