How To Install mosquitto on CentOS 8

mosquitto is An Open Source MQTT v3.1/v3.1.1 Broker

Introduction

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

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 8. In this tutorial we discuss both methods but you only need to choose one of method to install mosquitto.

Install mosquitto on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

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

sudo dnf -y install mosquitto

Install mosquitto on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

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

sudo yum -y install mosquitto

How To Uninstall mosquitto on CentOS 8

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

sudo dnf remove mosquitto

mosquitto Package Contents on CentOS 8

/etc/mosquitto
/etc/mosquitto/aclfile.example
/etc/mosquitto/mosquitto.conf
/etc/mosquitto/pskfile.example
/etc/mosquitto/pwfile.example
/usr/bin/mosquitto_passwd
/usr/bin/mosquitto_pub
/usr/bin/mosquitto_rr
/usr/bin/mosquitto_sub
/usr/lib/.build-id
/usr/lib/.build-id/1d
/usr/lib/.build-id/1d/a70caabc6fd80d7273e4e516a907ca8034af31
/usr/lib/.build-id/47
/usr/lib/.build-id/47/cb6bf93c51b3a46990f67a52fdcc11d24df0de
/usr/lib/.build-id/53
/usr/lib/.build-id/53/9fcca59a7543d663762a7d84535a2838483715
/usr/lib/.build-id/91
/usr/lib/.build-id/91/370d367d127263b9754e0deac903677668ae85
/usr/lib/.build-id/a0
/usr/lib/.build-id/a0/e94c6732b1156285ef9973a3e37e0ed3e30e21
/usr/lib/.build-id/b2
/usr/lib/.build-id/b2/ad77390e9d883bd7b2f672505117085de3db68
/usr/lib/.build-id/b8
/usr/lib/.build-id/b8/c465af92f7a9466e18ac4d58a0fb575fd6a37c
/usr/lib/systemd/system/mosquitto.service
/usr/lib64/libmosquitto.so.1
/usr/lib64/libmosquittopp.so.1
/usr/sbin/mosquitto
/usr/share/doc/mosquitto
/usr/share/doc/mosquitto/CONTRIBUTING.md
/usr/share/doc/mosquitto/ChangeLog.txt
/usr/share/doc/mosquitto/readme.md
/usr/share/licenses/mosquitto
/usr/share/licenses/mosquitto/LICENSE.txt
/usr/share/man/man1/mosquitto_passwd.1.gz
/usr/share/man/man1/mosquitto_pub.1.gz
/usr/share/man/man1/mosquitto_rr.1.gz
/usr/share/man/man1/mosquitto_sub.1.gz
/usr/share/man/man5/mosquitto.conf.5.gz
/usr/share/man/man7/mosquitto-tls.7.gz
/usr/share/man/man7/mqtt.7.gz
/usr/share/man/man8/mosquitto.8.gz

References

Summary

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