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 =========================================