On this page we tell you how te setup a MQTT Broker with authentication. We install an open source MQTT broker Eclipse Mosquito.
First download Eclipse Mosquito 64bit Windows version.
https://mosquitto.org/download/
Now open the downloaded file
mosquitto-x.x.x-install-windows-x64.exe
Click Next.
Choose to start Eclipse Mosquitto as Service and click Next.
Choose install location, we use the default. click install.
Click Finish
The Eclipe Mosquitto MQTT Broker is installed, now we must configurate the broker, we use a very basic configuration for now.
We enable authentication and set MQTT port to default 1883
Browse to the Mosquitto installation map in our case C:\Program Files\mosquitto
open mosquitto.conf i use notepad++ [download]
C:\Program Files\mosquitto\mosquitto.conf
Put the lines at the beginning of mosquitto.conf and save the file.
allow_anonymous false
port 1883
anonymous client are not allowed now. Now we must create a password file.
open a new Windows command prompt and go to the Mosquitto directory. In our case C:\Program Files\mosquitto.
cd C:\Program Files\mosquitto
Now we create an user client:
username: client
Password: test
We use passwords.txt as password file. Typ in the console mosquitto_passwd -c passwords.txt client press enter.
Enter now the password: test and press enter and re-enter your password.
mosquitto_passwd -c passwords.txt client
test
Now we created a user. If you want to create an another user, use the same command and replace client for a new username.
Now start the Mosquitto Broker in services.msc or run net start mosquitto in Windows command prompt
net start mosquitto
Now check that Mosquitto is running on port 1883, type in Windows command prompt:
netstat -a
The Eclipse Mosquitto Broker is up and running on port 1883.
Open port 1883 in your firewall inbound and outbound.
Complete installation video