Installare Mosquitto: broker MQTT per domotica

게시일 20/04/2026 사물인터넷
The Firmware Factory
광고
The Firmware Factory — 임베디드 기기를 위한 맞춤형 펌웨어 개발
자세히 보기
이 글은 아직 번역되지 않았습니다: 이탈리아어로 표시됩니다.

Installazione

sudo apt install mosquitto mosquitto-clients
sudo systemctl enable --now mosquitto

Creare un utente

sudo mosquitto_passwd -c /etc/mosquitto/passwd utente_mqtt

Inserisci la password quando richiesta.

Configurazione

Crea /etc/mosquitto/conf.d/default.conf:

listener 1883
allow_anonymous false
password_file /etc/mosquitto/passwd

Riavvia: sudo systemctl restart mosquitto.

Test

mosquitto_sub -h localhost -u utente_mqtt -P password -t test/#

In un'altra shell: mosquitto_pub -h localhost -u utente_mqtt -P password -t test/ciao -m "Hello"