CentOs7安装mosquitto

安装版本:mosquitto1.6.9

mosquitto官网: https://mosquitto.org/files/source/mosquitto-1.6.9.tar.gz

libwebsockets下载地址 :https://github.com/warmcat/libwebsockets/releases

yum install gcc gcc-c++
yum install openssl-devel
yum install c-ares-devel
yum install libuuid-devel
yum install wget
yum install cmake
yum install build-essential python quilt devscripts python-setuptools python3 
yum install libssl-dev libc-ares-dev uuid-dev daemon openssl-devel

下载并编译安装libwebsockets
wget https://github.com//warmcat/libwebsockets/archive/v4.0.15.tar.gz
cd libwebsockets-4.0.15/
mkdir build
cd build
cmake .. -DLIB_SUFFIX=64
make install
ldconfig

接下来就是下载mosquitto

mkdir /mqtt
cd /mqtt
wget http://mosquitto.org/files/source/mosquitto-1.6.9.tar.gz
tar -xzf mosquitto-1.6.9.tar.gz
cd mosquitto-1.6.9

直接一梭子

make && make install

然后把样例弄成配置文件

mv /etc/mosquitto/mosquitto.conf.example /etc/mosquitto/mosquitto.conf

在配置文件中 /etc/mosquitto/mosquitto.conf  把allow_anonymous true 去掉注释

直接启动

mosquitto -c /etc/mosquitto/mosquitto.conf //这种是调试用的,
 
mosquitto -c /etc/mosquitto/mosquitto.conf -d //后台运行

需要注意的问题,

扩展一定要安装全,在编译源码的时候就可以看到扩展的问题,

 

一定要在安全组放行你的端口号并且要设置成外网能访问的

 

 

  尝试连接mqtt

 

 

 

一梭子完成.

感谢  https://www.jianshu.com/p/eb1f6ed17409

每天进步一滴滴,

 

posted @ 2020-06-09 17:58  润土偷西瓜  阅读(1590)  评论(0编辑  收藏  举报