라즈베리파이에 아두이노 연결하고 mqtt 사용할거라 설치했다.
1. Mosquitto 설치
apt install -y mosquitto mosquitto-clients
2. Mosquitto 실행
$ systemctl enable mosquitto
Synchronizing state of mosquitto.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable mosquitto
$ systemctl start mosquitto
$ systemctl status mosquitto
● mosquitto.service - Mosquitto MQTT Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; preset: enabled)
Active: active (running) since Wed 2025-03-26 21:35:42 KST; 42s ago
Docs: man:mosquitto.conf(5)
man:mosquitto(8)
Main PID: 115906 (mosquitto)
Tasks: 1 (limit: 9573)
CPU: 15ms
CGroup: /system.slice/mosquitto.service
└─115906 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Mar 26 21:35:42 WAS-1 systemd[1]: Starting mosquitto.service - Mosquitto MQTT Broker...
Mar 26 21:35:42 WAS-1 systemd[1]: Started mosquitto.service - Mosquitto MQTT Broker.
3. mosquitto.conf 수정
$ cd /etc/mosquitto
$ nano mosquitto.conf
아래 부분을 추가한다.
listener 1883
protocol mqtt
listener 8081
protocol websockets
# 익명 접속 가능
# 추후에 수정 예정
allow_anonymous true
# 재실행
$ systemctl restart mosquitto
# 웹소켓 포트 확인
$ netstat -tulnp | grep 8081
tcp6 0 0 :::8081 :::* LISTEN 116110/mosquitto
'Network > Raspberry Pi 5' 카테고리의 다른 글
[Raspberry Pi 5] GUI 데스크톱 세팅(VNC) (0) | 2025.05.14 |
---|---|
[Raspberry Pi 5] jar 배포 (0) | 2025.03.03 |
[Raspberry Pi 5] Prometheus 시각화를 위한 Grafana 설치 및 연동 (0) | 2025.01.05 |
[Raspberry Pi 5] Docker를 이용한 Prometheus 설치 (2) | 2025.01.05 |
[Raspberry Pi 5] 운영(배포) 서버에 파일 업로드 시 하드디스크 경로에 업로드하기 (0) | 2025.01.04 |