1、Mosquitto源代码下载并解压
wget http://mosquitto.org/files/source/mosquitto-1.4.9.tar.gz
tar zxfv mosquitto-1.4.9.tar.gz
2、进入目录编译
cd mosquitto-1.4.9
make -j4
3、Mosquitto安装
sudo make install
出现如下错误:在mosquitto.mk中修改WITH_SRV:=yes为WITH_SRV:=no
继续编译,出现uuid找不到,执行sudo yum install libuuid-devel
其他错误,安装未遇到
1) .编译找不到openssl/ssl.h
安装openssl:sudo yum install openssl openssl-devel
3) ./mosquitto_internal.h:40:20: fatal error: ares.h: No such file or directory
解决办法:修改config.mk文件中的WITH_SRV:=yes为WITH_SRV:=no
4) .使用过程中找不到libmosquitto.so.1
error while loading shared libraries: libmosquitto.so.1: cannot open shared object file: No such file or directory
修改libmosquitto.so位置
# 创建链接
sudo ln -s /usr/local/lib/libmosquitto.so.1 /usr/lib/libmosquitto.so.1
# 更新动态链接库
sudo ldconfig
5) .Error: Invalid user 'mosquitto'.
直接在shell窗口中执行:useradd mosquitto 命令就可以了。