安装
sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
sudo apt-get update
sudo apt install mosquito
sudo apt install mosquitto-clients
配置etc/mosquito/mosquito.conf
sudo gedit mosquito.conf
添加内容:
allow_anonymous false
password_file /etc/mosquitto/pwfile
#acl_file /etc/mosquitto/aclfile
创建文件
sudo touch /etc/mosquitto/pwfile
创建用户
sudo mosquitto_passwd -c pwfile username
重启mosq服务
ps -ef | grep mos
sudo kill -9 pid
mosquitto -c /etc/mosquitto/mosquitto.conf