Inst mosquitto » History » Version 4
Michael Gunsch, 01/02/2023 06:20 PM
| 1 | 1 | Michael Gunsch | h1. Installation MQTT-Server (Broker) Mosquitto unter Debian |
|---|---|---|---|
| 2 | |||
| 3 | h2. Pakete installieren |
||
| 4 | |||
| 5 | <pre><code class="shell"> |
||
| 6 | sudo apt install mosquitto mosquitto-clients |
||
| 7 | </code></pre> |
||
| 8 | |||
| 9 | h2. Konfiguration |
||
| 10 | |||
| 11 | /etc/mosquitto/mosquitto.conf |
||
| 12 | |||
| 13 | <pre> |
||
| 14 | # Place your local configuration in /etc/mosquitto/conf.d/ |
||
| 15 | # |
||
| 16 | # A full description of the configuration file is at |
||
| 17 | # /usr/share/doc/mosquitto/examples/mosquitto.conf.example |
||
| 18 | |||
| 19 | pid_file /var/run/mosquitto.pid |
||
| 20 | |||
| 21 | persistence true |
||
| 22 | persistence_location /var/lib/mosquitto/ |
||
| 23 | persistent_client_expiration 30d |
||
| 24 | |||
| 25 | log_dest file /var/log/mosquitto/mosquitto.log |
||
| 26 | |||
| 27 | include_dir /etc/mosquitto/conf.d |
||
| 28 | </pre> |
||
| 29 | 2 | Michael Gunsch | |
| 30 | 3 | Michael Gunsch | Im Verzeichnis /etc/mosquitto/conf.d werden die Konfigurationsdateien hinterlegt. Die Angaben in spitzen Klammern, wie <host> sind anzupassen, die Spitzen Klammern sind wegzulassen. Beispiele für eine Verbindung (Bridge) zu einem anderen Mosquitto-Broker: |
| 31 | 2 | Michael Gunsch | |
| 32 | /etc/mosquitto/conf.d/andino.conf |
||
| 33 | |||
| 34 | <pre> |
||
| 35 | listener 1883 |
||
| 36 | |||
| 37 | connection <bridge-name> |
||
| 38 | address <host>:8883 |
||
| 39 | 4 | Michael Gunsch | allow_anonymous true |
| 40 | 2 | Michael Gunsch | bridge_cafile /etc/ssl/certs/ISRG_Root_X1.pem |
| 41 | remote_username <username> |
||
| 42 | remote_password <password> |
||
| 43 | # topic # out 1 "" <prefix>/ |
||
| 44 | # topic # in 1 <prefix>/ "" |
||
| 45 | topic # both 1 |
||
| 46 | </pre> |