Ubuntu 에서 Mosquitto 실행하기

$ sudo apt-get update
$ sudo apt-get install mosquitto

Do you want to continue? [Y/n]
$ sudo service mosquitto status
$ mosquitto_sub -t "mjc"

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

$ mosquitto_sub -t "mjc"\\

Untitled

Untitled

비밀번호 설정

publish 와 subscribe를 할 때 비밀번호가 없어도 되지만 보안이 필요한 경우 비밀번호 설정을 통해 보안을 강화시킨다.

$ sudo mosquitto_passwd -c /etc/mosquitto/passwd mjc

Untitled

Untitled

// Subscribe
$ mosquitto_sub -u "아이디" -P "비밀번호" -t "토픽명" 

// Publish
$ mosquitto_pub -u "아이디" -P "비밀번호" -t "토픽명" -m "메세지 내용"

비밀번호 확인

$ cat /etc/mosquitto/passwd

Untitled

MQTT.fx 설정

Untitled

Untitled

비밀번호 적용

$ sudo nano /etc/mosquitto/mosquitto.conf

Untitled

$ sudo nano /etc/mosquitto/conf.d/default.conf

Untitled

$ sudo systemctl restart mosquitto

sudo apt-get update를 입력한다.

sudo apt-get update 명령어는 운영체제에서 사용 가능한 패키지들과 그 버전에 대한 정보를 업데이트하는 명령어다. 설치되어 있는 패키지를 최신으로 업데이트하는 것이 아닌 설치가능한 리스트를 업데이트하는 것이다.

mosquitto프로그램을 설치한다.

Do you want to continue? 라는 말이 나오는데 Y 입력후 엔터 혹은 엔터를 눌러 진행한다.

[Y/n] 이 있는데 대문자로 표시 되어있는게 default값이다.

이는 엔터키를 누르면 Y로 인식한다는 뜻이다.

mosquitto 프로그램이 실행되고 있는지 확인하는 명령어이다.

mosquitto프로그램에서 mjc Topic을 publish하는 명령어이다.

톱니바퀴를 눌러 설정을 진행한다.

+버튼을 눌러서 추가한다.