Install Mosquitto MQTT

From JoBaPedia
Jump to navigation Jump to search

Mosquitto Installation

Prerequisites

sudo zypper in libcares-devel docbook-xsl-stylesheets
cd /usr/share/xml/docbook/stylesheet
sudo ln -s nwalsh/current docbook-xsl

Git Install

Currently I install the old rpm 1.4.10 for leap 42.2 to get the opensuse infrastructure. Then I install the latest tagged git version over it (need to adapt dest path to /usr in config.mk before calling make).

cd ~/workspace
git clone https://github.com/eclipse/mosquitto.git
cd mosquitto
git tag
git checkout v1.4.14
make
sudo make install

Configuration

Only needed if options need to be changed from defaults (e.g for TLS cert or PSK encryption). Better use the opensuse pattern of adding conf files in /etc/mosquitto/mosquitto.conf.d

sudo cp /etc/mosquitto/mosquitto.conf.example /etc/mosquitto/mosquitto.conf

Example

Use Arduino IDE to flash ESP-12e NodeMCU with PubSubClient mqtt_esp8266 example. LED_BUILTIN does not work on newer NodeMCU, simply use (GPIO 0)2.