MQTT - インストール - FreeBSD

 クラウディア
1. 概要
2. ports
3. インストール
4. Broker 操作

1. 概要

 「FreeBSD」でも、「MQTT」が使えるようなのであります。  以下、「FreeBSD 14.2 RELEASE」で。

2. ports

 「pkg search」コマンドで確認しますが。

$ pkg search mosquitto
mosquitto-2.0.18               Open source MQTT broker

$ pkg search mqtt
aws-c-mqtt-0.11.0              C99 implementation of the MQTT 3.1.1 and MQTT 5 specification
libpaho-mqtt3-1.3.13           Eclipse Paho C Client Library for the MQTT Protocol
mqtt2prometheus-0.1.7          Export MQTT metrics to prometheus
octave-forge-mqtt-0.0.5_2      Octave-forge package mqtt
p5-AnyEvent-MQTT-1.142640_1    AnyEvent Perl module for MQTT client
p5-Net-MQTT-1.143260_1         Perl modules for MQTT protocol
py311-mqttwarn-0.35.0_1        Subscribe to MQTT topics and notify pluggable services
py311-paho-mqtt-2.1.0          MQTT version 3.1/3.1.1 client class
qt6-mqtt-6.8.2                 Qt module implementing the MQTT protocol
rubygem-mqtt-0.6.0             Implementation of the MQTT protocol
zigbee2mqtt-1.42.0             Use your Zigbee devices without the vendor's bridge or gateway
 「Broker」「Client」ともにそろっているようです。  何を使えばいいんかが問題ではありますが・・・。

3. インストール

 とりあえず、「Broker」として「Mosquito」は、インストールしておきます。  「root」ユーザ権限で。

cd /usr/ports/net/mosquitto
make config
 オプションは、デフォルトのままにしておきます。
「/usr/ports/net/mosquitto」-「make config」


cd /usr/ports/net/mosquitto
make
make install
 インストール時のメッセージが下記のように表示されました。

Installing mosquitto-2.0.20...
===> Creating users
Using existing user 'nobody'
The mosquitto MQTT Python driver is now provided by net/py-paho-mqtt

===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/sbin/mosquitto

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
https://mosquitto.org/

4. Broker 操作

 サービスとして登録します。  「root」ユーザ権限で。

sysrc mosquitto_enable=YES
 これで、システム起動時には、必ず、「Broker」が起動されることになります。  起動。

service mosquitto start
 停止。

service mosquitto status
AbemaTV 無料体験