一、安裝
1、
apt-get install software-properties-common
(運行add-apt-repository命令時,有時會提示命令不存在,這個時候直接apt-get add-apt-repository是不可以的!解決的方法是安裝software-properties-common)
(1)引入mosquitto倉庫並更新
sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
sudo apt-get update
(2)安裝 mosquitto
sudo apt-get install mosquitto
(3)安裝客戶端
sudo apt-get install mosquitto-clients
(4)配置:
certs目錄下存放證書
新增.conf的配置文件
(5)運行:
mosquitto -c default.conf
(6)測試:連接成功
二、常用命令
1、mosquitto重啓
1.1 查看mosquitto的進程
命令:ps -aux | grep mosquitto
1.2 殺掉進程
命令:kill -9 18248
1.3 啓動
命令:mosquitto -c /etc/mosquitto/mosquitto.conf -d