Install Mosquitto Mqtt Broker on Ubuntu 20.04

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello friends welcome back today we are going to see how to install mosquito mqtt broker on the ubuntu best pc i am using ubuntu 20.04 this is the mosquito website from where you can download the mosquito mqtt broker come down over here here the procedure is given to download the mosquito on the ubuntu base system so we'll copy this command first now we will run the terminal so paste this command over here here we are adding the repository for the mosquito so run this command enter the password press enter after this run this command sudo apt-get update then type the command sudo apt-get install mosquito and run this command now we will install mosquito clients so for that purpose just type this command sudo apt-get install mosquito dash client run this command it should be mosquito dash clients and then run this command again so mosquito mqtt package has been installed let us see the status of the broker use this command system ctl status mosquito dot service and press enter so mosquito broker is running we will stop this broker by typing the command system ctl stop mosquito dot service press enter enter the password so mosquito mqtt broker service is stopped now we will type the command mosquito dash v and run this command we have done this because we want to see what is happening on the mqtt broker side so our broker is running we are going to add two more terminals so first terminal is used for the mqtt broker second terminal will be used for the publisher client and third terminal will be used for the subscriber client so we will run the subscriber client first by typing the command mosquito underscore sub specify the host specify the topic so we are using host as localhost right now so we will run this command t needs to be specified over here for topic so we will run this command so here you can see the subscriber has joined the broker so we will publish the message through the publisher client so for that purpose we will type the command mosquito underscore pub our host will be local host again topic will be test and our message will be hello so we will run this command now you can see publisher has published the message and it is first received by the broker and then the publisher has got disconnected at the same time as the subscriber has subscribed to this test topic it has received the message hello so this way we have published the message successfully so instead of localhost i'm going to try the ip address for this pc type the command ifconfig for me the ip address is this that is 192.168.1.100. copy this ip address we will try to run the publish command again with this new ip we will run our publish command with this new ip so press enter now you can see connection has been refused so we need to edit the mosquito.config file now we can see the mosquito dot config file is stored over here that is slash atc mosquito but we are not going to use this file instead we will use our custom file for that purpose we will start the text editor so write this statement listener183 so broker is going to listen port 183 type next statement allow underscore anonymous true save this document as test.conf so we will copy the path where the dot states.configuration file is saved we will stop the broker in the terminal by pressing control c so now we need to run the mosquito command again with the new configuration file so type this command mosquito dash c path for the configuration file and then the name of the configuration file that is test dot conf right dash v so we will run this command here you can see that configuration is loaded from the new configuration file that is dates dot config so we will stop the subscriber also by pressing ctrl c and instead of the localhost we are going to enter the our ip address that is 192.168 dot so we will run this command now the broker has accepted the connection from the subscriber so we will publish the message again so our command is ready just run this command by pressing enter so now you can see the message has been received by the subscriber and broker has allowed the connection as well we will publish another message that is publish and run this command again so now you can see subscriber has received the new message that is published in this video we have seen how to download the mosquito mqtt broker on the ubuntu best system also we have seen how to publish the messages and how to receive the message on the subscriber node so that's it for today thanks for watching the video if you like this video then please hit the like button please share this video with your friends and do not forget to subscribe to this channel thanks again and have a good time
Info
Channel: ADTechKnow
Views: 13,926
Rating: undefined out of 5
Keywords: Wireless, Technology, IOT, Mqtt, Install Mosquitto Mqtt Broker on Ubuntu, Mqtt Broker
Id: KOohvO4ngTw
Channel Id: undefined
Length: 7min 53sec (473 seconds)
Published: Sun Mar 06 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.