Difference between revisions of "Mosquitto from Source"

From Da Nerd Mage Wiki
Jump to navigation Jump to search
 
(21 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''<span style="color: rgb(132, 63, 161);" >The required tools:</span>'''
{{{!}} class="wikitable" style="float: right; width: 322px;" border="2"
{{!}}+ Proven on:
{{!}}- <!-- Debian -->
{{!}} style="text-align: center; width: 60px;" {{!}} [[File:Logo Debian.png{{!}}60px{{!}}link=https://www.debian.org/{{!}}center{{!}}middle{{!}}frameless]]
{{!}} style="text-align: center; width: 40px;" {{!}} 12 (bookworm)
{{!}}
<br>
{{!}}}
 
== '''<span style="color: rgb(132, 63, 161);">The required tools:</span>''' ==


* <code>apt install git build-essential autoconf cmake</code>
* <code>apt install git build-essential autoconf cmake</code>


'''<span style="color: rgb(132, 63, 161);" >Get the source:</span>'''
== '''<span style="color: rgb(132, 63, 161);">Get the source:</span>''' ==


* <code>git clone <nowiki>https://github.com/eclipse/mosquitto.git</nowiki></code>
* <code>git clone <nowiki>https://github.com/eclipse/mosquitto.git</nowiki></code>


'''<span style="color: rgb(132, 63, 161);" >The prerequisites:</span>'''
== '''<span style="color: rgb(132, 63, 161);">The prerequisites:</span>''' ==


* <code>apt install libc-ares-dev libwebsockets-dev libssl-dev xsltproc docbook-xsl libsystemd-dev libwrap0-dev openssl</code>
* <code>apt install libc-ares-dev libwebsockets-dev libssl-dev xsltproc docbook-xsl libsystemd-dev libwrap0-dev openssl</code>
* #   '''cJSON'''
* # '''cJSON'''
** <code>git clone <nowiki>https://github.com/DaveGamble/cJSON</nowiki></code>
** <code>git clone <nowiki>https://github.com/DaveGamble/cJSON</nowiki></code>
** <code>cd cJSON</code>
** <code>cd cJSON</code>
Line 19: Line 28:
** <code>sudo make install</code>
** <code>sudo make install</code>
** <code>cd ../..</code>
** <code>cd ../..</code>
* #   '''uthash / utlist'''
* # '''uthash / utlist'''
** <code>git clone <nowiki>https://github.com/troydhanson/uthash</nowiki></code>
** <code>git clone <nowiki>https://github.com/troydhanson/uthash</nowiki></code>
** <code>cp uthash/src/* mosquitto/include</code>
** <code>cp uthash/src/* mosquitto/include</code>
* # '''For testing'''
** <code>apt install python3-psutil</code>
** <code>git clone <nowiki>https://gitlab.com/cunity/cunit.git</nowiki></code>
** <code>cd cunit</code>
** <code>mkdir local-build</code>
** <code>cd local-build</code>
** <code>cmake ..</code>
** <code>cmake --build .</code>
** <code>sudo make install</code>
** <code>cd ../..</code>


'''<span style="color: rgb(132, 63, 161);" >Build it:</span>'''
== '''<span style="color: rgb(132, 63, 161);">Build it:</span>''' ==
 
* <code>cd mosquitto</code>
* <code>cd mosquitto</code>
* <code>make</code>
* <code>make</code>


'''<span style="color: rgb(132, 63, 161);" >Install it:</span>'''
== '''<span style="color: rgb(132, 63, 161);">Test it:</span>''' ==
 
* <code>make test</code>
or
* <code>make check</code>
'''Note:''' There are a fairly large number of tests that bring this to a grinding halt unless you comment them out. MUCH more research is needed...
 
24/1474 [[Mosquitto from Source Test Failures{{!}}tests]] fail...
 
18 of those make the test procedure halt...
 
== '''<span style="color: rgb(132, 63, 161);">Install it:</span>''' ==
 
* <code>adduser --system --group mosquitto</code>


* <code>sudo make install</code>
* <code>sudo make install</code>


To be done:
* <code>sudo cp /etc/mosquitto/mosquitto.conf.example /etc/mosquitto/mosquitto.conf</code>
 
== '''<span style="color: rgb(132, 63, 161);">Enable it as a systemd service:</span>''' ==
 
* <code>sudo cp service/systemd/mosquitto.service.simple /etc/systemd/system/mosquitto.service</code>
 
* <code>sudo vi /etc/systemd/system/mosquitto.service</code>
 
Fix the location in line 8.
 
The install step on Debian puts the executable in '''/usr/local/sbin''' not '''/usr/sbin'''
 
* <code>sudo systemctl daemon-reload</code>
 
* <code>sudo systemctl restart mosquitto.service</code>
 
= '''<span style="color: rgb(186, 55, 42); text-decoration: underline;">To be done:</span>'''=
 
== '''<span style="color: rgb(132, 63, 161);">Configure it:</span>''' ==
 
Default configuration works just fine like a default install from the repos...
 
That said...
 
* <code>sudo vi /etc/mosquitto/mosquitto.conf</code>
 
For now, take a look at the huge selection of options in there.
 
After making any changes:
* <code>sudo service mosquitto restart</code>
 
== '''<span style="color: rgb(132, 63, 161);">Use it:</span>''' ==


'''<span style="color: rgb(132, 63, 161);" >Configure it:</span>'''
This is a very deep rabbit hole.


'''<span style="color: rgb(132, 63, 161);" >Use it:</span>'''
= Resources =
* [https://mosquitto.org/documentation/ Mosquitto Documentation]
* [https://github.com/eclipse/mosquitto Mosquitto GitHub Repo]

Latest revision as of 19:22, 3 March 2024

Proven on:
Logo Debian.png
12 (bookworm)


The required tools:

  • apt install git build-essential autoconf cmake

Get the source:

  • git clone https://github.com/eclipse/mosquitto.git

The prerequisites:

  • apt install libc-ares-dev libwebsockets-dev libssl-dev xsltproc docbook-xsl libsystemd-dev libwrap0-dev openssl
  • # cJSON
    • git clone https://github.com/DaveGamble/cJSON
    • cd cJSON
    • mkdir build
    • cd build
    • cmake ..
    • make
    • sudo make install
    • cd ../..
  • # uthash / utlist
    • git clone https://github.com/troydhanson/uthash
    • cp uthash/src/* mosquitto/include
  • # For testing
    • apt install python3-psutil
    • git clone https://gitlab.com/cunity/cunit.git
    • cd cunit
    • mkdir local-build
    • cd local-build
    • cmake ..
    • cmake --build .
    • sudo make install
    • cd ../..

Build it:

  • cd mosquitto
  • make

Test it:

  • make test

or

  • make check

Note: There are a fairly large number of tests that bring this to a grinding halt unless you comment them out. MUCH more research is needed...

24/1474 tests fail...

18 of those make the test procedure halt...

Install it:

  • adduser --system --group mosquitto
  • sudo make install
  • sudo cp /etc/mosquitto/mosquitto.conf.example /etc/mosquitto/mosquitto.conf

Enable it as a systemd service:

  • sudo cp service/systemd/mosquitto.service.simple /etc/systemd/system/mosquitto.service
  • sudo vi /etc/systemd/system/mosquitto.service

Fix the location in line 8.

The install step on Debian puts the executable in /usr/local/sbin not /usr/sbin

  • sudo systemctl daemon-reload
  • sudo systemctl restart mosquitto.service

To be done:

Configure it:

Default configuration works just fine like a default install from the repos...

That said...

  • sudo vi /etc/mosquitto/mosquitto.conf

For now, take a look at the huge selection of options in there.

After making any changes:

  • sudo service mosquitto restart

Use it:

This is a very deep rabbit hole.

Resources