Category: Mosquitto

Setup a Mosquitto Password

sudo service mosquitto stop
cd /usr/local/bin
If you already Created a Password & want to change that then using below Command
mosquitto_passwd -D /etc/mosquitto/passwd username
Below Command is for New Password Creation
mosquitto_passwd -c /etc/mosquitto/passwd username
Password
Re-Enter
sudo nano /etc/mosquitto/mosquitto.conf
allow anonymous false
#Default authentication and topic access control

#password_file /etc/mosquitto/passwd
 sudo service mosqquitto start
 sudo service mosquitto status
Advertisement

How to Install Mosquitto On Windows

Step 1: Download mosquito from the Download section of Mosquitto.org.

stepi1

Step 2: It will take you to the Eclipse repository with mirror options through which you can download the exe file.

stepi2

Step 3: Double clicking the downloaded exe will throw you with the following screen through you might need to download the OpenSSL and pThreads.

step3

Quick Links:

pThreads: ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/dll/x86/

OpenSSL: http://slproweb.com/products/Win32OpenSSL.html

Step 4: Download the Win32 OpenSSL v1.0.2c Light setup file and install it. 

stepi4

Step 5: The next step would be asking if you want to install the service too, select it and click next

stepi6

Step 6: Select install location as given below

tepi7

Step 7: Installation will get progressed once you press Install as given below

tepi8

Step 8: How to check if Mosquitto broker has started and running? use the command netstat -an from the command prompt

stepi10

How to Install Mosquitto On Ubuntu

Step 1. Run following command on ec2 instance:-

sudo apt-get install mosquito

sudo apt-get update
 sudo apt-get install pkg-config cmake openssl libc-ares-dev libssl-dev python-mosquitto

sudo apt-get install gcc make g++ libssl-dev

wget http://mosquitto.org/files/source/mosquitto-1.4.7.tar.gz

tar xzf mosquitto-1.4.7.tar.gz

cd mosquitto-1.4.7

cmake .
 sudo make install

sudo mkdir /etc/mosquitto

sudo mv /usr/local/etc/mosquitto/mosquitto.conf /etc/mosquitto/mosquitto.conf

Step 2. Run following commands create service mosquitto:-

sudo nano /etc/init/mosquitto.conf

Add following lines to file:-

start on net-device-up
 respawn
 exec /usr/local/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Step 3. Add user to mosquitto:-

cd /usr/local/bin

sudo mosquitto_passwd -c /etc/mosquitto/passwd password