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.

Eclipse Mosquitto Setup installation Welcome screen

Choose to start Eclipse Mosquitto as Service and click Next.

 Eclipse Mosquitto Setup feature setup option run as service

Choose install location, we use the default. click install.

Eclipse Mosquitto Setup folder selection

 Click Finish

Eclipse Mosquitto Setup is now installed

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

Eclipse Mosquitto config file setup port and authentication

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

Change directory Windows command prompt

 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.

 Command create new user for Eclipse Mosquitto Mqtt

Now start the Mosquitto Broker in services.msc or run net start mosquitto in Windows command prompt

net start mosquitto

Start Mosquitto broker service in Services.msc

Now check that Mosquitto is running on port 1883, type in Windows command prompt:

netstat -a

 Eclipse Mosquitto Check running services on specified port 1883

The Eclipse Mosquitto Broker is up and running on port 1883.

Open port 1883 in your firewall inbound and outbound.

Complete installation video