Presenting the way I learnt it.

Step by step installing and configuring Mosquitto with Windows 7

Mosquitto is a MQTT (MQ Telemetry Transport) broker used for handling lightweight data transfer protocol. This broker is based on open source which implements MQTT v 3.1 and v3.1.1 as I write this post. This Post would be useful for someone who would like to configure Mosquitto in Windows 7 and test it.

Step 1: Download mosquito from the Download section of Mosquitto.org. In this example we will go through the use of the first link which would be native build applicable for Windows Vista and above.

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


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

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. We need to get couple of DLL files from this installation which we will see it in the subsequent steps.

Pthreadvc2.dll will be found as given below which can right click and save it to the folder you need.

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

Step 6: Select install location as given below

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

Step 8: Now the installation is done, we need to make sure the following files are copied to the folder where Mosquitto is installed.

Dependencies – win32

Required DLLs: libeay32.dll ssleay32.dll (Look for these files in the OpenSSL-Win32 or OpenSSL-Win32\Bin folder)

Required DLLs: pthreadVC2.dll

Important Note: Please ensure that the required DLLs are on the system path, or are in the same directory as the mosquitto executable.

Step 9: You need to reinstall Mosquitto so that it will also configure the windows Services as shown below as it has the necessary pre-requisites now in the folder C:\Program Files (x86)\mosquitto.

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

In another post we will see how we can test the Mosquitto on MQTTLens using Chrome Extensions, mosquitto_pub and mosquitto_sub.

82 responses to “Step by step installing and configuring Mosquitto with Windows 7”

  1. Installing and using MQTT Lens with Mosquitto | Sharing of tech stuff

    […] In this post I will try to outline how to use Mqtt Lens an useful chrome extension developed by Sanndro which can help you test the installation done as per my previous post Mosquitto broker installation. […]

    Like

  2. tommy teo Avatar
    tommy teo

    very useful, thanks alot

    Like

    1. seesiva Avatar
      seesiva

      Thanks for your good. Feeling good that it helped you.

      Like

    2. vegoil_bear Avatar
      vegoil_bear

      The latest version of OpenSSL 1.1.0 (26 Jan) does not contain libeap32.dll or ssleay32.eap. These can be found in the earlier version on the site 1.0.2.

      Liked by 2 people

      1. fadhliazmin Avatar
        fadhliazmin

        Yeah VB,

        I face that too, so I choose the installer with name “Win32 OpenSSL v1.0.2m Light”

        Like

      2. Rodrigo Avatar
        Rodrigo

        Good job!

        Like

    3. tony brands Avatar
      tony brands
  3. Neeraj Avatar
    Neeraj

    Thanks a lot!.

    Like

  4. Akila Avatar
    Akila

    i have done every installation properly and ensured that the dll files are at mosquitto folder but still i m unable to see that particular line in cmd prompt (TCP 0:0:0:1883…)can anyone pls help me out?

    Like

    1. Minh Le Avatar
      Minh Le

      Try to restart your computer, friend. I tried and TCP 1883 appeared.

      Like

      1. ui Avatar
        ui

        use 1884

        Like

  5. seesiva Avatar
    seesiva

    Did you checked if the Mosquitto broker services are running?

    Like

  6. Akila Avatar
    Akila

    Yes I checked bt it Doesn’t i dnt knw hw to rectify it can u pls suggest me some ways????

    Like

  7. Dalila Avatar
    Dalila

    Hello,
    i cant’ found Services (step 9 ) help plz

    Like

  8. Dalila Avatar
    Dalila

    Hi

    Like

  9. Hypatie Dalila Avatar
    Hypatie Dalila

    Hi i can not find Service in mosquitto folder help plz

    Like

  10. Want to connect real-time apps with IOT device where resources are scarce. – LuaGeek Blog
  11. Ankur Avatar
    Ankur

    Hi,
    I followed the above steps but still I’m not able to see mqtt running as shown. Although when I run the executable file in my installation directory it shows a MSVCR120.dll missing. Even if I place the required DLL in the installation directory it fails to run. Can you please suggest any solution. Thank you

    Like

    1. seesiva Avatar
      seesiva

      Start->Run->services.msc to check the services. Please copy the DLL files mentioned in the blog to the System32 folder.

      Like

    2. seesiva Avatar
      seesiva

      It has to be placed in the Windows\system32 directory

      Like

    3. agit Avatar
      agit

      install this(x86) to get required dll. -> https://www.microsoft.com/en-us/download/confirmation.aspx?id=40784

      Like

  12. Motofarer Avatar
    Motofarer

    I have done every installation step properly and ensured that the dll files are at Mosquitto folder but still I’m unable to see that particular line in cmd prompt (TCP 0:0:0:1883…). I’ve even tried restarting my laptop without any success. Can anyone pls help me out? How to check if the Mosquitto broker services are running?

    Like

    1. seesiva Avatar
      seesiva

      Start->Run->services.msc to check the services. Please copy the DLL files mentioned in the blog to the System32 folder.

      Liked by 1 person

      1. Motofarer Avatar
        Motofarer

        Sorted. Thanks.

        Like

  13. Hemal Avatar
    Hemal

    I am very new to Mosquitto so apologies if I am asking stupid question. I have installed mosquitto server on my local system. I am able to see Mosquitto server running but I need to run mosquitto.exe explicitly from the command prompt. I am also able to publish and subscribe the messages. Now my question is how can I connect this server to other clients like mobile or other clients like hardware (esp8266). Any help in this area would be highly appreciated.

    Liked by 1 person

    1. seesiva Avatar
      seesiva

      Use MQTT Lens to connect to the MQTT Broker. Please check my other post on MQTT Lens

      Like

  14. Ankur Mittal Avatar
    Ankur Mittal

    Hi,
    Thanks for the help above, although i was able to run the service successfully after some tweaking here’n’there. Just wanted to know, to introduce client authorization i set ‘allow_anonymous’ to false and provide path to ‘password_file’ in mosquitto.conf and start broker with this config file. But still the broker allows client connections without any username and pass

    Like

    1. seesiva Avatar
      seesiva

      Have you restarted the service?

      Like

    2. emma Avatar
      emma

      pls ankur coud u explain how u fixed msvcr issue. thanks

      Like

  15. san Avatar
    san

    Hi, when I open the MQTT lens, it keeps saying connection lost to my pc.
    Anyway to find out why?

    Like

    1. seesiva Avatar
      seesiva

      It could be because some firewall issues or some conflicting issues. If you have found out please share.

      Like

      1. Emillio Avatar
        Emillio

        Hello Friend.
        Thanks a lot for this tutorial!
        I made all the steps above and now I’m able to subscribe and publish messages with the MQTT lens, but I also want to connect to the broker with my mobile phone using some App from the Play market. This is never working for me and I receive error connection failed on the App.
        Do I need to configure something else to make everything working?
        Thanks in advance!

        Like

  16. Mark Traverse Avatar
    Mark Traverse

    working on Windows 10. Excellent. Thanks for a very informative guide.

    Like

  17. Emillio Avatar
    Emillio

    Hi Friend. Thanks for the both tutorials!
    I made all the installations like described and now I’m able to subscribe and publish messages in the MQTTLens. Now I’m trying to connect to the broker from my mobile phone with special App for the MQTT and it never connects to the server.
    Do I need to configure anything else for that?
    Thanks in advance.

    Like

  18. ESP8266 và IOT (Part 2): ESP8266 với MQTT – LinhKienBK

    […] broker Mosquio trên may Window. Bạn có thể tìm các hướng dẫn sao để cài đặt ở đây. Bạn phải sử dụng IP address của bạn thay cho domain name. Có vấn đề với nó […]

    Like

  19. Julian Alberto Castiblanco Palacios Avatar
    Julian Alberto Castiblanco Palacios

    Grate post. Thank you for share it.

    Like

  20. Rama Avatar
    Rama

    Hi,am new to mqtt am unable to find the mqttbroker in services

    Like

    1. seesiva Avatar
      seesiva

      Did you looked for Mosquitto?

      Like

  21. Emil Telstad Avatar
    Emil Telstad

    Doesn’t work. I have all the required files in mosquitto directory. Reinstalled mosquitto, but it’s still not running as a service.

    Like

    1. seesiva Avatar
      seesiva

      Did you try restarting the machine ?

      Like

      1. Emil Telstad Avatar
        Emil Telstad

        Yes

        Like

      2. seesiva Avatar
        seesiva

        May be attempt to install one more time and make sure you are in the administrator role during installation.

        Like

  22. Dhruv Acharya Avatar
    Dhruv Acharya

    Thank you sir. I have followed all the steps successfully. But only one problem. I have to download “Win32 OpenSSL v1.0.2j Light” instead of “Win32 OpenSSL v1.0.2c Light”. Will it create any problem in future?

    Like

  23. Jim Peternel Avatar
    Jim Peternel

    I am installing this on a win 7 pc. While the installs run fine I am unable to find the required files libeay32.dll ssleay32.dll. I also installed the OpenSSL hoping that it would provide the needed files but they are not there. I also get an error for cygcrypto-1.0.0.dll. I was able to find an install Pthreadvc2.dll .

    Like

    1. Manish Avatar
      Manish

      Even i am facing the same problem

      Like

  24. Duncan Avatar
    Duncan

    Could not find the dll files you specified in the Win32OpenSSL directories or the bin directory.

    Like

    1. Fongu389 Avatar
      Fongu389

      solved my issue with not having the files in folder and service not starting

      http://slproweb.com/download/Win32OpenSSL_Light-1_0_2j.exe

      Like

  25. tp Avatar
    tp

    It says it couldnt start, Error Code (0xc000007b)
    What can I do? I followed all Steps above

    Like

    1. zorry Avatar
      zorry

      same for me. who can help?

      Like

      1. seesiva Avatar
        seesiva

        Did you try restarting your machine and check if the services have started???

        Like

  26. MQTT tutorial on Raspberry pi, Arduino and Python – Build A Site Info

    […] to install mosquitto on Windows: Step by step installing and configuring Mosquitto with Windows 7 […]

    Like

  27. RD Avatar
    RD

    thank you for the tuto. But I didn’t find the MQTT broker service. I didn’t know what is the problem??

    Like

  28. Karl’s Home Automation Project – Part 1: Home Assistant & YAML, MQTT, Sonoff, and Xmas Lights

    […] 3.5.2 64-bit. There are newer versions now. Mosquitto was the most difficult. I followed this guide but substituted Win32OpenSSL_Light-1_0_2j.exe approx 2MB. A k version is available now. Home […]

    Like

  29. John Anastasiou Avatar
    John Anastasiou

    Cannot start it. It say err 0x-00007b

    Like

  30. super169 Avatar
    super169

    32bit version Microsoft Visual C++ Runtime is also required, but it has not been mentioned in the document. Maybe most people writing such installation guide already have this installed.

    You may download the latest version from https://www.microsoft.com/en-us/download/details.aspx?id=53587.

    Please also noted that, you must use vc_redist.x86.exe instead of vc_redist.x64.exe even you are running under 64bit Windows.

    Liked by 1 person

    1. seesiva Avatar
      seesiva

      Thanks for your inputs. May be you’re right because when I tried I had visual studio in my Machine already available. Thanks for the sharing the links as well it would be useful for many.

      Like

  31. Butler-MQTT and a realtime reload dashboard for Sense - Ptarmigan Labs Avatar
    Butler-MQTT and a realtime reload dashboard for Sense – Ptarmigan Labs

    […] MQTT server. Mosquitto works really well. Installing on Linux is trivial, as is OSX (using Homebrew). Windows users can also use Mosquitto, good guides are found here and here. […]

    Like

  32. Stefano Avatar
    Stefano

    Hi,
    first of all great job !!!
    I tried to install Mosquitto on a win 7 pc, I followed all steps but the install doesn’t work.
    The error is:
    VCRUTIMEE140.dll isn’t present in the computer.
    Reinstalled mosquitto, but the error is still present.
    Can you help me ?
    Thanks
    Stefano

    Like

    1. nvhie001 Avatar
      nvhie001

      You need to install the C runtime library for Visual Studio, likely the 32 bit version from here:
      https://www.microsoft.com/en-us/download/details.aspx?id=48145

      Like

  33. Ismet Isnaini Avatar
    Ismet Isnaini

    hi, i got my mosquitto running. when i try to build my subscriber using golang (the publisher is from arduino), it has got an error. the program was initially made for fedora, so its got

    MQTT “git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git”

    in the import part..

    but now, when i try to run it in windows, offcourse it will not recognize that…

    how do i get those packages ?

    best regards

    Like

  34. MQTT with lwip and NXP FRDM-K64F Board | MCU on Eclipse Avatar
    MQTT with lwip and NXP FRDM-K64F Board | MCU on Eclipse
  35. Parambir Avatar
    Parambir

    I installed the Moquitto on my Win 10. But after copying the three DLL to mosquitto folder I am getting an error “The application was unable to start…) Any help please.

    Like

  36. MQTT tutorial on Raspberry pi, Arduino and Python | Happy Coding

    […] Link to install mosquitto on Windows: Step by step installing and configuring Mosquitto with Windows 7 […]

    Like

  37. Step by step installing and configuring Mosquitto with Windows 7 | Ordo 13

    […] Source: Step by step installing and configuring Mosquitto with Windows 7 […]

    Like

  38. henriquerobertosilva Avatar
    henriquerobertosilva

    Tks man !!!! So useful to me !!!! Keep in this way, sharing the knowledge !!!! THANKS !

    Like

  39. IOT MQTT: Simple Node-Red + Raspberry Pi | WanGReadY Avatar
    IOT MQTT: Simple Node-Red + Raspberry Pi | WanGReadY
  40. Tanvi Avatar
    Tanvi

    Hi ,
    I have been trying to install mosquitto on 32 bit windows 10 machine for around 2 weeks now. NOTHING seems to work. It is giving application cannot be started (0x0150002) error. Please help

    Like

  41. Mini Controllers » MQTT tutorial on Raspberry pi, Arduino and Python

    […] to install mosquitto on Windows: Step by step installing and configuring Mosquitto with Windows 7 […]

    Like

  42. Ivan Lewis Avatar
    Ivan Lewis

    How to start secured connection with port 8880?

    Like

  43. JLaffan Avatar
    JLaffan

    I am getting error “Ordinal not found”
    “The ordinal 341 could not be located in the dynamic link library SSLEAY32.dll”

    I’ve tried all of the above.

    Like

  44. NeilU Avatar
    NeilU

    I tried the installer for latest release 1.4.14 on my Win7 m/c.
    I found I had to use an older OpenSSL Light installer other than the latest 1.1.0g in order to get the missing DLL’s, I used 1.0.2c.
    Having got past this if found it also wanted VCRUNTIME140.dll, which I found on my Win10 laptop.

    However even after feeding it with all the missing DLL’s it won’t run. (To say it has an installer must be a joke).

    When I run the mosquito.exe I get an error saying it was unable to start correctly 0xC000 007b

    Does this program really work ? What am I missing ?

    Like

  45. MQTT tutorial on Raspberry pi, Arduino and Python | MiniArduino

    […] to install mosquitto on Windows: Step by step installing and configuring Mosquitto with Windows 7 […]

    Like

  46. meera Avatar
    meera

    After successful installation of message broker, how to work with MQTT client and MQTT pub

    Like

  47. MQTT tutorial on Raspberry Pi, Arduino and Python | FreeDown

    […] Link to install mosquitto on Windows: Step by step installing and configuring Mosquitto with Windows 7 […]

    Like

  48. MQTT tutorial on Raspberry pi, Arduino and Python – Coding Videos

    […] to install mosquitto on Windows: Step by step installing and configuring Mosquitto with Windows 7 […]

    Like

  49. durk Avatar
    durk

    You say: Step 9: You need to reinstall Mosquitto so that it will also configure the windows Services as shown below as it has the necessary pre-requisites now in the folder C:\Program Files (x86)\mosquitto.

    How do I reinstall it? When I run mosquitto-1.5.4-install-windows-x64.exen gain, it just installs the version without windows service, i.e. it overwrites the version with the dll’s necessary for a windows service. Did you actually try this out yourself?

    Like

Leave a comment