mqtt 搭建push服务

时间:2021-03-24 13:25:03

mqtt 搭建push服务

一 安装mosquitto 

sudo yum install c-ares-devel.x86_64

wget http://mosquitto.org/files/source/mosquitto-1.3.4.tar.gz
tar zxvf mosquitto-1.3.4.tar.gz
cd mosquitto-1.3.4
make
sudo make install

安装完成后
/usr/local/sbin/mosquitto
/usr/local/bin/mosquitto_passwd
/usr/local/bin/mosquitto_sub
/usr/local/bin/mosquitto_pub

配置文件

/etc/mosquitto/
cd /etc/mosquitto/
cp mosquitto.conf.example mosquitto.conf

测试步骤

1 启动服务
/usr/local/sbin/mosquitto
2 sub
/usr/local/bin/mosquitto_sub -t mqtt
3 pub
/usr/local/bin/mosquitto_pub -t mqtt -m hello2

yum install c-ares-devel.x86_64
yum install gcc-c++.x86_64
sudo make prefix=/usr/local/mosquitto/epoll install