이전 자료
출처
•
명령어 모음집 (한꺼번에 다 복붙)
cd ~
wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
sudo apt-key add mosquitto-repo.gpg.key
cd ..
cd ..
cd ..
cd ..
cd ..
cd etc/apt/sources.list.d/
sudo wget http://repo.mosquitto.org/debian/mosquitto-stretch.list
sudo apt-get update
sudo apt-cache search mosquitto
sudo apt-get install mosquitto mosquitto-clients
sudo /etc/init.d/mosquitto start
mosquitto_sub -d -t hello/world
Arduino
복사
•
다른 창 열고 아래 명령어 입력
mosquitto_pub -d -t hello/world -m "Hi!"
Arduino
복사
•
실행 화면
pi@raspberrypi:~ $ cd ~
pi@raspberrypi:~ $ wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
g.key--2021-03-28 19:18:53-- http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
Resolving repo.mosquitto.org (repo.mosquitto.org)... 85.119.83.194, 2001:ba8:1f1:f271::2
Connecting to repo.mosquitto.org (repo.mosquitto.org)|85.119.83.194|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3167 (3.1K) [application/octet-stream]
Saving to: ‘mosquitto-repo.gpg.key’
mosquitto-repo.gpg.key 100%[============================>] 3.09K --.-KB/s in 0.001s
2021-03-28 19:18:54 (2.06 MB/s) - ‘mosquitto-repo.gpg.key’ saved [3167/3167]
pi@raspberrypi:~ $ sudo apt-key add mosquitto-repo.gpg.key
OK
pi@raspberrypi:~ $ cd /etc/apt/source.list.d/
bash: cd: /etc/apt/source.list.d/: No such file or directory
pi@raspberrypi:~ $ cd /etc/apt/source.list.d/
bash: cd: /etc/apt/source.list.d/: No such file or directory
pi@raspberrypi:~ $ ls
Bookshelf Documents mosquitto-repo.gpg.key Pictures Templates
Desktop Downloads Music Public Videos
pi@raspberrypi:~ $ cd ..
pi@raspberrypi:/home $ ls
pi
pi@raspberrypi:/home $ cd //
pi@raspberrypi:// $ cd ..
pi@raspberrypi:// $ cd ..
pi@raspberrypi:// $ ls
bin dev home lost+found mnt proc run srv tmp var
boot etc lib media opt root sbin sys usr
pi@raspberrypi:// $ cd /etc/apt/source.list.d/
bash: cd: /etc/apt/source.list.d/: No such file or directory
pi@raspberrypi:// $ cd etc/apt/sources.list.d/
pi@raspberrypi://etc/apt/sources.list.d $ sudo wget http://repo.mosquitto.org/debian/mosquitto-stretch.list
--2021-03-28 19:20:39-- http://repo.mosquitto.org/debian/mosquitto-stretch.list
Resolving repo.mosquitto.org (repo.mosquitto.org)... 85.119.83.194, 2001:ba8:1f1:f271::2
Connecting to repo.mosquitto.org (repo.mosquitto.org)|85.119.83.194|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 51 [application/octet-stream]
Saving to: ‘mosquitto-stretch.list’
mosquitto-stretch.list 100%[============================>] 51 --.-KB/s in 0s
2021-03-28 19:20:40 (1.30 MB/s) - ‘mosquitto-stretch.list’ saved [51/51]
pi@raspberrypi://etc/apt/sources.list.d $ sudo apt-get update
o
Get:1 http://archive.raspberrypi.org/debian buster InRelease [32.9 kB]
Get:2 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
Get:3 https://repo.mosquitto.org/debian stretch InRelease [12.4 kB]
Get:4 http://archive.raspberrypi.org/debian buster/main armhf Packages [372 kB]
Get:5 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages [13.0 MB]
Get:6 https://repo.mosquitto.org/debian stretch/main all Packages [4,893 B]
Get:7 https://repo.mosquitto.org/debian stretch/main armhf Packages [40.8 kB]
Get:8 http://raspbian.raspberrypi.org/raspbian buster/non-free armhf Packages [104 kB]
Fetched 13.6 MB in 51s (266 kB/s)
Reading package lists... Done
pi@raspberrypi://etc/apt/sources.list.d $ sudo apt-cache search mosquitto
libmosquittopp-dev - MQTT version 3.1 client C++ library, development files
libmosquittopp1 - MQTT version 3.1/3.1.1 client C++ library
mosquitto-dev - Development files for Mosquitto
libmosquitto-dev - MQTT version 3.1/3.1.1/5.0 client library, development files
libmosquitto1 - MQTT version 3.1/3.1.1/5.0 client library
libmosquitto1-dbg - debugging symbols for libmosquitto binaries
libmosquitto1-dbgsym - Debug symbols for libmosquitto1
libmosquittopp1-dbg - debugging symbols for libmosquittopp binaries
libmosquittopp1-dbgsym - Debug symbols for libmosquittopp1
mosquitto - MQTT version 3.1/3.1.1/5.0 compatible message broker
mosquitto-clients - Mosquitto command line MQTT clients
mosquitto-clients-dbgsym - Debug symbols for mosquitto-clients
mosquitto-dbg - debugging symbols for mosquitto binaries
mosquitto-dbgsym - Debug symbols for mosquitto
pi@raspberrypi://etc/apt/sources.list.d $ sudo apt-get install mosquitto mosquitto-clients
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libev4 libmosquitto1 libuv1 libwebsockets12
Suggested packages:
apparmor
The following NEW packages will be installed:
libev4 libmosquitto1 libuv1 libwebsockets12 mosquitto mosquitto-clients
0 upgraded, 6 newly installed, 0 to remove and 103 not upgraded.
Need to get 596 kB of archives.
After this operation, 1,334 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.harukasan.org/raspbian/raspbian buster/main armhf libev4 armhf 1:4.25-1 [34.5 kB]
Get:2 http://ftp.harukasan.org/raspbian/raspbian buster/main armhf libuv1 armhf 1.24.1-1 [96.7 kB]
Get:3 https://repo.mosquitto.org/debian stretch/main armhf libmosquitto1 armhf 2.0.9-0mosquitto1~stretch1 [80.3 kB]
Get:4 https://repo.mosquitto.org/debian stretch/main armhf libwebsockets12 armhf 2.4.2-0mosquitto1~stretch1 [92.2 kB]
Get:5 https://repo.mosquitto.org/debian stretch/main armhf mosquitto armhf 2.0.9-0mosquitto1~stretch1 [188 kB]
Get:6 https://repo.mosquitto.org/debian stretch/main armhf mosquitto-clients armhf 2.0.9-0mosquitto1~stretch1 [105 kB]
Fetched 596 kB in 3s (199 kB/s)
Selecting previously unselected package libev4:armhf.
(Reading database ... 98440 files and directories currently installed.)
Preparing to unpack .../0-libev4_1%3a4.25-1_armhf.deb ...
Unpacking libev4:armhf (1:4.25-1) ...
Selecting previously unselected package libmosquitto1:armhf.
Preparing to unpack .../1-libmosquitto1_2.0.9-0mosquitto1~stretch1_armhf.deb ...
Unpacking libmosquitto1:armhf (2.0.9-0mosquitto1~stretch1) ...
Selecting previously unselected package libuv1:armhf.
Preparing to unpack .../2-libuv1_1.24.1-1_armhf.deb ...
Unpacking libuv1:armhf (1.24.1-1) ...
Selecting previously unselected package libwebsockets12:armhf.
Preparing to unpack .../3-libwebsockets12_2.4.2-0mosquitto1~stretch1_armhf.deb ...
Unpacking libwebsockets12:armhf (2.4.2-0mosquitto1~stretch1) ...
Selecting previously unselected package mosquitto.
Preparing to unpack .../4-mosquitto_2.0.9-0mosquitto1~stretch1_armhf.deb ...
Unpacking mosquitto (2.0.9-0mosquitto1~stretch1) ...
Selecting previously unselected package mosquitto-clients.
Preparing to unpack .../5-mosquitto-clients_2.0.9-0mosquitto1~stretch1_armhf.deb ...
Unpacking mosquitto-clients (2.0.9-0mosquitto1~stretch1) ...
Setting up libmosquitto1:armhf (2.0.9-0mosquitto1~stretch1) ...
Setting up libev4:armhf (1:4.25-1) ...
Setting up mosquitto-clients (2.0.9-0mosquitto1~stretch1) ...
Setting up libuv1:armhf (1.24.1-1) ...
Setting up libwebsockets12:armhf (2.4.2-0mosquitto1~stretch1) ...
Setting up mosquitto (2.0.9-0mosquitto1~stretch1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/mosquitto.service → /lib/systemd/system/mosquitto.service.
Processing triggers for systemd (241-7~deb10u5+rpi1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10+rpi1) ...
pi@raspberrypi://etc/apt/sources.list.d $ sudo /etc/init.d/mosquitto start
[ ok ] Starting mosquitto (via systemctl): mosquitto.service.
pi@raspberrypi://etc/apt/sources.list.d $ mosquitto_sub -d -t hello/world
Client (null) sending CONNECT
Client (null) received CONNACK (0)
Client (null) sending SUBSCRIBE (Mid: 1, Topic: hello/world, QoS: 0, Options: 0x00)
Client (null) received SUBACK
Subscribed (mid: 1): 0
Client (null) received PUBLISH (d0, q0, r0, m0, 'hello/world', ... (3 bytes))
Hi!
Client (null) received PUBLISH (d0, q0, r0, m0, 'hello/world', ... (3 bytes))
Hi!
Client (null) received PUBLISH (d0, q0, r0, m0, 'hello/world', ... (3 bytes))
Hi!
Arduino
복사
•
다른 창 화면
pi@raspberrypi:/etc/apt/sources.list.d $ mosquitto_pub -d -t hello/world -m "Hi!"
Client (null) sending CONNECT
Client (null) received CONNACK (0)
Client (null) sending PUBLISH (d0, q0, r0, m1, 'hello/world', ... (3 bytes))
Client (null) sending DISCONNECT
pi@raspberrypi:/etc/apt/sources.list.d $ mosquitto_pub -d -t hello/world -m "Hi!"
Client (null) sending CONNECT
Client (null) received CONNACK (0)
Client (null) sending PUBLISH (d0, q0, r0, m1, 'hello/world', ... (3 bytes))
Client (null) sending DISCONNECT
pi@raspberrypi:/etc/apt/sources.list.d $ mosquitto_pub -d -t hello/world -m "Hi!"
Client (null) sending CONNECT
Client (null) received CONNACK (0)
Client (null) sending PUBLISH (d0, q0, r0, m1, 'hello/world', ... (3 bytes))
Client (null) sending DISCONNECT
pi@raspberrypi:/etc/apt/sources.list.d $
Arduino
복사