centOS7下安装mosquitto服务

在centOS7下安装mosquitto可以使用yum安装,也可以直接下载源代码安装,我一般使用源代码安装,因为需要mosquitto的提供的C++头文件以及对应的so动态连接库进行C++的mqtt客户端封装。
github上面的源代码地址为:Eclipse Mosquitto - An open source MQTT broker https://mosquitto.org
https://www.eclipse.org/mosquitto/download/
https://mosquitto.org/download/
安装完之后需要配置,在CSDN上面找到一篇不错的博客,地址为:MQTT服务器搭建–Mosquitto用户名密码配置
还有一篇博客:Mosquitto 高级应用之用户配置
我在配置mosquitto.conf配置文件时出现一个错误如下:

Error: Invalid user 'mosquitto'.
The reason is simple, user is not configured. As user is root we have to declare root user un mosquitto configuration. So edit /etc/mosquitto/mosquitto.conf file and add at user sectionuser root需要配置当前用户名。

原因找到了,centOS7系统下默认没有mosquitto这个用户,解决方法有两个:
1、将user mosquitto哪一行配置改成user root
2、添加一个mosquitto用户

	su root
	adduser mosquitto
	passwd mosquitto
发布了107 篇原创文章 · 获赞 35 · 访问量 97万+

猜你喜欢

转载自blog.csdn.net/ccf19881030/article/details/103997896
今日推荐