2019年7月

Linux下软件环境安装(8)-MQTT Mosquitto安装与配置

装在docker里ubuntu 18.04.2
docker run -ti -h mqtt -p 8882:22 -p 8883:1883 --name mqtt withsshd
apt-get install software-properties-common
apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
apt-get update
apt-get install mosquitto mosquitto-clients
service mosquitto status
service mosquitto start
这样就OK了!

以上的似乎不OK了,新版2.0.7
wget https://mosquitto.org/files/source/mosquitto-2.0.7.tar.gz
tar -xzvf mosquitto-2.0.7.tar.gz
cd mosquitto-2.0.7
make
问题:
mosquitto_ctrl.h:21:10: fatal error: cjson/cJSON.h: No such file or directory
sudo apt install libcjson-dev
make
sudo make install
sudo cp /etc/mosquitto/mosquitto.conf.example /etc/mosquitto/mosquitto.conf
sudo adduser mosquitto
12345
mosquitto -v -c /etc/mosquitto/mosquitto.conf
默认配置文件是空的,需要添加
allow_anonymous true
listener 1883 0.0.0.0