techwitheddie

MQTT

Feb 20th, 2021 (edited)
5,036
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.53 KB | None | 1 0
  1. MQTT Install
  2.         sudo apt-get install mosquitto -y
  3.         sudo apt-get install mosquitto-clients
  4.  
  5. Configure MQTT
  6.         sudo nano /etc/mosquitto/mosquitto.conf
  7.  
  8. Append these lines to the bottom of the file and save it:
  9.         allow_anonymous false
  10.         password_file /etc/mosquitto/pwfile
  11.         listener 1883
  12.        
  13. Set an MQTT username and password
  14.         sudo mosquitto_passwd -c /etc/mosquitto/pwfile YOUR-NEW-MQTT-USERNAME
  15.  
  16. Test the broker
  17.         mosquitto_sub -d -u YOUR-MQTT-USERNAME -P YOUR-MQTT-PASSWORD -t dev/test
  18.  
Add Comment
Please, Sign In to add comment