mosquitto安装时在解压压缩包后生成的文件夹中我们可以找到mosquitto主要配置文件config.mk
这个文件的主要内容:
# 是否支持tcpd/libwrap功能. #WITH_WRAP:=yes # 是否开启SSL/TLS支持 #WITH_TLS:=yes # 是否开启TLS/PSK支持 #WITH_TLS_PSK:=yes # Comment out to disable client client threading support. #WITH_THREADING:=yes # 是否使用严格的协议版本(老版本兼容会有点问题) #WITH_STRICT_PROTOCOL:=yes # 是否开启桥接模式 #WITH_BRIDGE:=yes # 是否开启持久化功能 #WITH_PERSISTENCE:=yes # 是否监控运行状态 #WITH_MEMORY_TRACKING:=yes
默认情况下Mosquitto的安装需要OpenSSL的支持;如果不需要SSL,则需要关闭config.mk里面的某些与SSL功能有关的选项(WITH_TLS、WITH_TLS_PSK)。接着,就是运行make install进行安装,完成之后会在系统命令行里发现mosquitto、mosquitto_passwd、mosquitto_pub和mosquitto_sub四个工具(截图如下),分别用于启动代理、管理密码、发布消息和订阅消息。
mosquitto-auth-plug-master中的config.mk.in文件内容
# Select your backends from this list BACKEND_CDB ?= no BACKEND_MYSQL ?= yes BACKEND_SQLITE ?= no BACKEND_REDIS ?= no BACKEND_POSTGRES ?= no BACKEND_LDAP ?= no BACKEND_HTTP ?= no BACKEND_JWT ?= no BACKEND_MONGO ?= no BACKEND_FILES ?= no BACKEND_MEMCACHED ?= no # Specify the path to the Mosquitto sources here # MOSQUITTO_SRC = /usr/local/Cellar/mosquitto/1.4.12 MOSQUITTO_SRC = # Specify the path the OpenSSL here OPENSSLDIR = /usr # Add support for django hashers algorithm name SUPPORT_DJANGO_HASHERS ?= no # Specify optional/additional linker/compiler flags here # On macOS, add # CFG_LDFLAGS = -undefined dynamic_lookup # as described in https://github.com/eclipse/mosquitto/issues/244 # # CFG_LDFLAGS = -undefined dynamic_lookup -L/usr/local/Cellar/openssl/1.0.2l/lib # CFG_CFLAGS = -I/usr/local/Cellar/openssl/1.0.2l/include -I/usr/local/Cellar/mosquitto/1.4.12/include CFG_LDFLAGS = CFG_CFLAGS =