How To install Mosquitto MQTT Broker on Raspberry Pi.

Run these commands:

sudo apt update

Install Mosquitto Broker, Hit Y to confirm installation.

sudo apt install -y mosquitto mosquitto-clients

Automatic startup Mosquitto:

sudo systemctl enable mosquitto.service

Edit the config file:

sudo nano /etc/mosquitto/mosquitto.conf

Default setting:

IP: Your Raspberry Pi IP
Port: 1883
Allow anonymous: True
TLS: False