echo 实用笔记:OpenWRT 安装 mosqutto 实现 MQTT 服务

  1. 更新 opkg update
  2. 安装 mosqutto
opkg install mosquitto-nossl libmosquitto-nossl
  1. /etc/mosquitto/mosquitto.conf末尾插入两行文本
echo -e "allow_anonymous false\npassword_file /etc/mosquitto/pwfile" >> /etc/mosquitto/mosquitto.conf

注释:"-e"表示激活转义字符,"\n"表示换行,"\t"表示Tab键

  1. /etc/mosquitto/pwfile末尾插入文本
echo "amqtt:mymqtt" >> /etc/mosquitto/pwfile
  1. 重启 mosqutto 服务
/etc/init.d/mosquitto restart

你可能感兴趣的:(笔记)