Using OS : 2012-08-16-wheezy-raspbian
Grab the latest build from
http://mosquitto.org/download/
I downloaded the following
http://mosquitto.org/files/source/mosquitto-1.0.2.tar.gz
Steps
1. Created a “Mosquitto_MQTT” directory
$ sudo mkdir Mosquitto_MQTT
/home/pi/Mosquitto_MQTT
2. Copied the “mosquitto-1.0.2.tar.gz” to the the following path using WinSCP
Refer my WinSCP and Putty Tutorial for help with Copying file and Putty Usage.
Enabling SSH on Raspberry Pi and using Putty and WinSCP « Raspberry Pi Adventures
Follow these commands to Install
$ sudo apt-get install libwrap0-dev
$ tar zxf mosquitto-1.0.2.tar.gz
$ cd mosquitto-0.15
$ make
$ sudo make install
$ sudo ldconfig
$ sudo make clean
$ sudo iptables -A INPUT -p tcp -m tcp --dport 1883 -j ACCEPT
Configuration File Location for Reference
/etc/mosquitto/mosquitto.conf
Putty Window 1 – Raspberry Pi
Start Mosquitto Daemon on Raspberry Pi using Putty
$ mosquitto
Putty Window 2 – Raspberry Pi – Subscribe
Open Putty Connection 1 to Raspberry Pi To Subscribe
$ mosquitto_sub -d -t hello/world
OR
$ mosquitto_sub -h raspberrypi -d -t hello/world
OR
$ mosquitto_sub -h 192.168.1.2 -d -t hello/world
Where 192.168.1.2 is your Raspberry Pi’s IP Address
Putty Window 3 – Raspberry Pi – Publish
Open Putty Connection 2 to Raspberry Pi To Publish
$ mosquitto_pub -d -t hello/world -m "Message To Send"
OR
$ mosquitto_pub -h raspberrypi -d -t hello/world -m "Message To Send"
OR
$ mosquitto_pub -h 192.168.1.2 -d -t hello/world -m "Message To Send"
Where 192.168.1.2 is your Raspberry Pi’s IP Address
Note: Messages you type in Publish Window will be visible in Subscribe Window
References
MQ Telemetry Transport » wiki » mosquitto_message_broker
Hello MQTT — Michael Connors
Getting Started with MQTT