Mosquitto是一個輕量級的MQTT Broker,支持不少種系統。python
下載與安裝:http://mosquitto.org/download/git
注意:因爲客戶端paho工程進展較快,目前須要使用最新的3.1.1版本的mqosuitto服務器才能鏈接,所以用Ubuntu內置庫的mosquitto將沒法正常訪問。shell
安裝最新的1.4以上版本的Mosquitto(適用於全部基於Debian的Linux ,如Ubuntu系列):
服務器
#!/bin/sh #To use the new repository you should first import the repository package signing key: wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key sudo apt-key add mosquitto-repo.gpg.key #Then make the repository available to apt: cd /etc/apt/sources.list.d/ #Then one of the following, depending on which version of debian you are using: sudo wget http://repo.mosquitto.org/debian/mosquitto-wheezy.list #sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list #Then update apt information: sudo apt-get update #And discover what mosquitto packages are available: sudo apt-cache search mosquitto #Or just install: sudo apt-get install mosquitto echo ========================================= echo MQTT Broker-Mosquitto Server Installed. echo =========================================
安裝Paho基於Python的MQTT客戶端:eclipse
#!/bin/sh echo ========================================= echo Install MQTT Paho client for python. git clone git://git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.python.git cd org.eclipse.paho.mqtt.python sudo python setup.py install echo ========================================= echo MQTT Python client from Paho Installed. echo =========================================