Mosquitto是一个轻量级的MQTT Broker,支持很多种系统。
下载与安装:http://mosquitto.org/download/
注意:由于客户端paho工程进展较快,目前需要使用最新的3.1.1版本的mqosuitto服务器才能连接,因此用Ubuntu内置库的mosquitto将无法正常访问。
安装最新的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客户端:
#!/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 =========================================