IoT

※前提条件:本情報はubentu12.04 LTS 15.04を基づいて説明してる

环境 [edit]

下载

进入mosquitto下载网址:https://mosquitto.org/download/,如下图

配置 [edit]

修改mosquitto配置,安装成功后,在安装文件夹下。找到mosquitto.conf 文件,用编辑器打开。

端口 [edit]

找到linstener,取消前面的#注释,并指定要侦听的端口,如下:

listener 7788

设置用户名密码 [edit]

找到allow_anonymous节点,这个节点作用是,是否开启匿名用户登录,默认是true。打开此项配置(将前面的 # 号去掉)之后将其值改为true

修改前:#allow_anonymous
修改后:allow_anonymous false

用户保存位置 [edit]

找到password_file节点,这个节点是告诉服务器你要配置的用户将存放在哪里。打开此配置并指定pwfile.example文件路劲(注意是绝对路劲)

修改前:#password_file
修改后:password_file D:\pwfile.example

启动mosquitto服务 [edit]

在管理工具->服务,中找到Mosquitto Broker,启动mosquitto服务

创建用户 [edit]

建立用户名和密码、打开命令窗口 键入以下命令:

mosquitto_passwd -c /etc/mosquitto/pwfile.example admin

mosquitto_passwd /etc/mosquitto/pwfile.example mosquitto

注意第二次建立用户时不用加 -c 若是加 -c 会把第一次建立的用户覆盖。

至此两个用户建立成功,此时若是查看 pwfile.example 文件会发现其中多了两个用户。


コメント:



(画像の文字列を入力して下さい)

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS