⭐️ Amazon Web Service/AWS IoT

[mosquitto on EC2 #1] MQTT 대표 서비스 Mosquitto 설치하기!!

mini_world 2021. 9. 10. 15:56
목차 접기

EC2에 간단히 mosquitto를 설치하도록 하겠습니다.

 

1. EPEL 설치

# yum install -y epel-release 

[root@host /]# yum install -y epel-release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: download.cf.centos.org
 * extras: download.cf.centos.org
 * updates: download.cf.centos.org
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================
 Package                               Arch                            Version                          Repository                       Size
==============================================================================================================================================
Installing:
 epel-release                          noarch                          7-11                             extras                           15 k

Transaction Summary
==============================================================================================================================================
Install  1 Package

Total download size: 15 k
Installed size: 24 k
Downloading packages:
경고: /var/cache/yum/x86_64/7/extras/packages/epel-release-7-11.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for epel-release-7-11.noarch.rpm is not installed
epel-release-7-11.noarch.rpm                                                                                           |  15 kB  00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-7.1908.0.el7.centos.x86_64 (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-11.noarch                                                                                                   1/1
  Verifying  : epel-release-7-11.noarch                                                                                                   1/1

Installed:
  epel-release.noarch 0:7-11

Complete!

 

2. mosquitto 설치

# yum install -y mosquitto 

[root@host /]# yum install -y mosquitto
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                                   | 5.4 kB  00:00:00
 * base: download.cf.centos.org
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: download.cf.centos.org
 * updates: download.cf.centos.org
epel                                                                                                                   | 4.7 kB  00:00:00
(1/3): epel/x86_64/group_gz                                                                                            |  96 kB  00:00:00
(2/3): epel/x86_64/primary_db                                                                                          | 7.0 MB  00:00:00
(3/3): epel/x86_64/updateinfo                                                                                          | 1.0 MB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package mosquitto.x86_64 0:1.6.10-1.el7 will be installed
--> Processing Dependency: libwebsockets.so.13()(64bit) for package: mosquitto-1.6.10-1.el7.x86_64
--> Running transaction check
---> Package libwebsockets.x86_64 0:3.0.1-2.el7 will be installed
--> Processing Dependency: libuv.so.1()(64bit) for package: libwebsockets-3.0.1-2.el7.x86_64
--> Running transaction check
---> Package libuv.x86_64 1:1.41.0-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================
 Package                              Arch                          Version                                 Repository                   Size
==============================================================================================================================================
Installing:
 mosquitto                            x86_64                        1.6.10-1.el7                            epel                        287 k
Installing for dependencies:
 libuv                                x86_64                        1:1.41.0-1.el7                          epel                        153 k
 libwebsockets                        x86_64                        3.0.1-2.el7                             epel                        118 k

Transaction Summary
==============================================================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 557 k
Installed size: 1.4 M
Downloading packages:
경고: /var/cache/yum/x86_64/7/epel/packages/libuv-1.41.0-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Public key for libuv-1.41.0-1.el7.x86_64.rpm is not installed
(1/3): libuv-1.41.0-1.el7.x86_64.rpm                                                                                   | 153 kB  00:00:00
(2/3): libwebsockets-3.0.1-2.el7.x86_64.rpm                                                                            | 118 kB  00:00:00
(3/3): mosquitto-1.6.10-1.el7.x86_64.rpm                                                                               | 287 kB  00:00:00
----------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                         1.6 MB/s | 557 kB  00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-11.noarch (@extras)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:libuv-1.41.0-1.el7.x86_64                                                                                                1/3
  Installing : libwebsockets-3.0.1-2.el7.x86_64                                                                                           2/3
  Installing : mosquitto-1.6.10-1.el7.x86_64                                                                                              3/3
  Verifying  : libwebsockets-3.0.1-2.el7.x86_64                                                                                           1/3
  Verifying  : mosquitto-1.6.10-1.el7.x86_64                                                                                              2/3
  Verifying  : 1:libuv-1.41.0-1.el7.x86_64                                                                                                3/3

Installed:
  mosquitto.x86_64 0:1.6.10-1.el7

Dependency Installed:
  libuv.x86_64 1:1.41.0-1.el7                                        libwebsockets.x86_64 0:3.0.1-2.el7

Complete!

 

3. mosquitto 서비스 시작

# systemctl start mosquitto && systemctl enable mosquitto && systemctl enable mosquitto

[root@host /]# systemctl start mosquitto

[root@host /]# systemctl enable mosquitto
Created symlink from /etc/systemd/system/multi-user.target.wants/mosquitto.service to /usr/lib/systemd/system/mosquitto.service.

[root@host /]# systemctl status mosquitto
● mosquitto.service - Mosquitto MQTT v3.1/v3.1.1 Broker
   Loaded: loaded (/usr/lib/systemd/system/mosquitto.service; enabled; vendor preset: disabled)
   Active: active (running) since 금 2021-09-10 06:49:58 UTC; 15s ago
     Docs: man:mosquitto.conf(5)
           man:mosquitto(8)
 Main PID: 8603 (mosquitto)
   CGroup: /system.slice/mosquitto.service
           └─8603 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

 9월 10 06:49:58 ip-172-31-9-26.ap-northeast-2.compute.internal systemd[1]: Starting Mosquitto MQTT v3.1/v3.1.1 Broker...
 9월 10 06:49:58 ip-172-31-9-26.ap-northeast-2.compute.internal mosquitto[8603]: 1631256598: mosquitto version 1.6.10 starting
 9월 10 06:49:58 ip-172-31-9-26.ap-northeast-2.compute.internal mosquitto[8603]: 1631256598: Config loaded from /etc/mosquitto/mosquitt...nf.
 9월 10 06:49:58 ip-172-31-9-26.ap-northeast-2.compute.internal mosquitto[8603]: 1631256598: Opening ipv4 listen socket on port 1883.
 9월 10 06:49:58 ip-172-31-9-26.ap-northeast-2.compute.internal mosquitto[8603]: 1631256598: Opening ipv6 listen socket on port 1883.
 9월 10 06:49:58 ip-172-31-9-26.ap-northeast-2.compute.internal systemd[1]: Started Mosquitto MQTT v3.1/v3.1.1 Broker.
Hint: Some lines were ellipsized, use -l to show in full.

 

 


 

728x90