Project

General

Profile

Inst mosquitto » History » Revision 7

Revision 6 (Michael Gunsch, 01/04/2023 09:19 AM) → Revision 7/9 (Michael Gunsch, 08/07/2023 05:40 PM)

h1. Installation MQTT-Server (Broker) Mosquitto unter Debian 

 h2. Pakete installieren 

 <pre><code class="shell"> 
 sudo apt install mosquitto mosquitto-clients 
 </code></pre> 

 

 h2. Konfiguration 

 /etc/mosquitto/mosquitto.conf  

 <pre> 
 # Place your local configuration in /etc/mosquitto/conf.d/ 
 # 
 # A full description of the configuration file is at 
 # /usr/share/doc/mosquitto/examples/mosquitto.conf.example 

 pid_file /var/run/mosquitto.pid 

 persistence true 
 persistence_location /var/lib/mosquitto/ 
 persistent_client_expiration 30d 

 log_timestamp_format %Y-%m-%dT%H:%M:%S 
 log_dest file /var/log/mosquitto/mosquitto.log 

 include_dir /etc/mosquitto/conf.d 
 </pre> 

 Im Verzeichnis /etc/mosquitto/conf.d werden die Konfigurationsdateien hinterlegt. Die Angaben in spitzen Klammern, wie <host> sind anzupassen, die Spitzen Klammern sind wegzulassen. Beispiel für eine Verbindung (Bridge) zu einem anderen Mosquitto-Broker: 

 /etc/mosquitto/conf.d/andino.conf 

 <pre> 
 listener 1883 

 connection <bridge-name> 
 address <host>:8883 
 allow_anonymous true 
 bridge_cafile /etc/ssl/certs/ISRG_Root_X1.pem 
 remote_username <username> 
 remote_password <password> 
 # topic # out 1 "" <prefix>/ 
 # topic # in 1 <prefix>/ "" 
 topic # both 1 
 </pre> 

 

 h2. Test 

 <pre> 
 mosquitto_sub -h localhost -t '#' -v 
 </pre>