Linux安装mosquitto mqtt几种方式
Eclipse Mosquitto是一个开源消息代理,实现了MQTT协议版本3.1和3.1.1。提供轻量级的,支持可发布/可订阅的的消息推送模式,Mosquitto的轻量,适用于低功耗单板计算机到完整服务器的所有设备。Mosquitto项目还提供了用于实现MQTT客户端的C库以及非常受欢迎的mosquitto_pub和mosquitto_sub命令行MQTT客户端。
Linux离线安装mosquitto
官方下载地址: https://mosquitto.org/download/
wget http://mosquitto.org/files/source/mosquitto-1.4.5.tar.gz
tar -zxvf mosquitto-1.4.5.tar.gz
cd mosquitto-1.4.5/
make
sudo make install
cp mosquitto.conf /etc/mosquitto/
mosquitto -v
groupadd mosquitto
useradd -g mosquitto mosquitto
ps -aux | grep mosquitto
mosquitto -c /etc/mosquitto/mosquitto.conf -d -v
mosquitto-1.6.10版本的安装
tar -zxvf mosquitto-1.6.10.tar.gz
cd mosquitto-1.6.10/
make
sudo make install
cp mosquitto.conf /etc/mosquitto/
cp /usr/local/sbin/mosquitto /usr/sbin/
mosquitto -h
groupadd mosquitto
useradd -g mosquitto mosquitto -s /sbin/nologin
ps -aux | grep mosquitto
cp mosquitto.service /etc/systemd/system/
chmod +x /etc/systemd/system/mosquitto.service
systemctl daemon-reload
systemctl enable mosquitto.service
systemctl is-enabled mosquitto.service
systemctl start mosquitto.service
systemctl status mosquitto.service
ps -aux | grep mosquitto
CentOS在线安装mosquitto
yum install -y mosquito
mosquitto MQTT 高版本 2.x以上远程访问设置
mosquitto MQTT 高版本 2.x以上,默认是:只能本机访问, 且不能匿名访问 增加: allow_anonymous true 允许匿名访问 listener 1883 可以远程访问
cat /etc/mosquitto/mosquitto.conf
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
allow_anonymous true
listener 1883
参考链接: https://www.jianshu.com/p/9e3cb7042a2e https://www.jianshu.com/p/a0efd843a39f https://www.shangmayuan.com/a/b088b32fe79d411bb6ac849d.html https://www.icode9.com/content-3-901950.html https://www.pianshen.com/article/70141267956/ https://my.oschina.net/wujinghust/blog/661167
|