The broker is the server that is running somewhere in the network. It could be in the same machine, but it could also be in another machine on another continent, as long as it can be accessed through the network. The most basic connection from a client to a broker only needs two parameters :
the address IP of the machine where the broker is running
the port number of the machine
Be sure that this port is open in the firewall of the machine and network. Further options are available such as sessions protected by a username and password authentification.
Several broker do exists for this purpose. An easy one to deploy and use for testing is probably Mosquitto. To install it, simply run :sudo apt install mosquitto mosquitto-clients
The first package is the broker itself, while the second can be used as testing clients.
To start the broker, run either :# start it as a service $ sudo service mosquitto start # start it manually with verbose output $ mosquitto -v
To test the broker with clients, run :# start the broker $ mosquitto -v # start a subscriber node on the topic "/test" $ mosquitto_sub -t "/test" # start a publisher on the same topic $ mosquitto_pub -m "test message" -t "/test"