How to install MQTT Broker on Raspberry Pi | IoT Server | Getting Started and Testing

Поделиться
HTML-код
  • Опубликовано: 15 сен 2024
  • In this video, I have explained how you can install MQTT Mosquitto Broker on Raspberry Pi. I have given a background on what is MQTT and tested it using Windows MQTTBox software
    Hope you like it !!
    *Installing Mosquitto Broker on Raspberry Pi*
    1) Boot your Raspberry Pi, Open SSH terminal or VNC Viewer and Login into your RPI
    2) Run the following command to upgrade and update your system
    sudo apt update && sudo apt upgrade
    It is always good to update and upgrade. This step will take time depending on what is installed and updated.
    3) To install the Mosquitto Broker enter these next command
    sudo apt install -y mosquitto mosquitto-clients
    5) To make Mosquitto auto start when the Raspberry Pi boots, you need to run the following command
    sudo systemctl enable mosquitto.service
    This command will automatically start Mosquitto Broker on Raspberry Pi boot
    6) To check the installation, run the following command to check the Mosquitto Broker version
    mosquitto -v
    This returns the Mosquitto version that is currently running on your Raspberry Pi
    *Broker Enable Remote Access/ Authentication*
    *****************************************************************
    *No Authentication Process*
    1) Edit the file mosquitto.conf
    Go to the root directory of the file sudo nano /etc/mosquitto/mosquitto.conf
    2) Add these lines at the end
    allow_anonymous true #Allow any node to connect with the broker - without any authentication
    listener 1883 #Defining the listener port
    Save and Exit
    3) Restart the Mosquitto Broker
    sudo systemctl restart mosquitto
    This will reflect the changes done the config file
    ********************************************************************
    *Authentication Process*
    1) Run the following command
    sudo mosquitto_passwd -c /etc/mosquitto/PASSWORD USERNAME
    This will allow you to add a new username by creating a folder in /etc/mosquitto directory.
    As soon as you type it, it will ask you for the password that will be hidden
    2) Edit the file mosquitto.conf
    Go to the root directory of the file sudo nano /etc/mosquitto/mosquitto.conf
    3) Add these lines at the end
    allow_anonymous false #Allow specific nodes to connect with the broker - with authentication
    listener 1883 #Defining the listener port
    password_file /etc/mosquitto/PASSWORD
    Save and Exit
    3) Restart the Mosquitto Broker
    sudo systemctl restart mosquitto
    This will reflect the changes done to the config file
    Informative Website - mosquitto.org/...
    -----------------------------------------------------------------------------------------------------------
    You can support my channel at-- Paytm: +91-8655761125
    Paypal: paypal.me/elec...
    -----------------------------------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------------------------------
    Some of my other videos are:
    What is MQTT | How it works? | IoT Projects | Features and Comparison
    • What is MQTT | How it ...
    How to Install MQTT Mosquitto Broker in Windows | IoT Development | Publish-Subscribe messaging
    • How to Install MQTT Mo...
    How to Install MQTT Mosquitto Broker Software in Windows | IoT Development
    • How to Install MQTT Mo...
    How to Install Anydesk on Raspberry Pi | Remote Control & Access
    • How to Install Anydesk...
    DHT22 Temperature and Humidity Interfacing with Arduino | Digital One wire sensor
    • DHT22 Temperature and ...
    MLX90614 Arduino Tutorial | Non-contact Temperature sensor | I2C Protocol | Infrared Sensor
    • MLX90614 Arduino Tutor...
    -----------------------------------------------------------------------------------------------------------

Комментарии • 4

  • @RogerSRSZ
    @RogerSRSZ 3 месяца назад +1

    Thanks for putting this together it has been useful, however I think you could have finished the video off better by adding in the necessary commands for the Subscriber with Authentification and showing it rather than sayying to go to library of commands to find it. For reference the commands that should be added at the end >Mosquitto_sub -t first/test -u “user” -P “pwd”

    • @electrofun5135
      @electrofun5135  3 месяца назад

      I am glad you found the video useful. Thank you for your feedback. I will make sure I consider it the next time. Thanks

  • @ddonq1412
    @ddonq1412 5 месяцев назад

    Struggling to get this working. Got raspberry pi as a VM. It's not connecting via anonymous

    • @electrofun5135
      @electrofun5135  5 месяцев назад

      I have limited knowledge working with VMs and hence I am not sure on the support for the libraries I have used will work for VM or not. You will need to further investigate and check it. Thanks