- 更新
opkg update
- 安装
mosqutto
opkg install mosquitto-nossl libmosquitto-nossl
- 向
/etc/mosquitto/mosquitto.conf
末尾插入两行文本
echo -e "allow_anonymous false\npassword_file /etc/mosquitto/pwfile" >> /etc/mosquitto/mosquitto.conf
注释:"-e"表示激活转义字符,"\n"表示换行,"\t"表示Tab键
- 向
/etc/mosquitto/pwfile
末尾插入文本
echo "amqtt:mymqtt" >> /etc/mosquitto/pwfile
- 重启
mosqutto
服务
/etc/init.d/mosquitto restart