05 | centos安装emq

1 环境准备

通过arch 、lscpu、lsb_release -a 查看环境配置

[root@centos7 ~]# arch
x86_64
[root@centos7 ~]# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 158
Model name:            Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
Stepping:              10
CPU MHz:               3192.003
CPU max MHz:           0.0000
CPU min MHz:           0.0000
BogoMIPS:              6384.00
Hypervisor vendor:     VMware
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              12288K
NUMA node0 CPU(s):     0,1
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch epb invpcid_single fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
[root@centos7 ~]# lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 7.9.2009 (Core)
Release:	7.9.2009
Codename:	Core

2 拉取Emqx包

wget https://www.emqx.com/zh/downloads/broker/4.2.14/emqx-centos7-4.2.14-x86_64.rpm

执行结果:

--2022-10-10 22:04:34--  https://www.emqx.com/zh/downloads/broker/4.2.14/emqx-centos7-4.2.14-x86_64.rpm
Resolving www.emqx.com (www.emqx.com)... XXx
Connecting to www.emqx.com (www.emqx.com)|xx|:443... connected.
HTTP request sent, awaiting response... 
302 Found
Location: https://packages.emqx.net/emqx-ce/v4.2.14/emqx-centos7-4.2.14-x86_64.rpm [following]
--2022-10-10 22:04:35--  https://packages.emqx.net/emqx-ce/v4.2.14/emqx-centos7-4.2.14-x86_64.rpm
Resolving packages.emqx.net (packages.emqx.net)... xxx
Connecting to packages.emqx.net (packages.emqx.net)|xxx|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20747068 (20M) [application/x-redhat-package-manager]
Saving to: ‘emqx-centos7-4.2.14-x86_64.rpm’

100%[=================================================================>] 20,747,068  19.2MB/s   in 1.0s   

2022-10-10 22:04:37 (19.2 MB/s) - ‘emqx-centos7-4.2.14-x86_64.rpm’ saved [20747068/20747068]

[root@centos7 ~]# 

3 安装服务

sudo yum install emqx-centos7-4.2.14-x86_64.rpm
Loaded plugins: fastestmirror
Examining emqx-centos7-4.2.14-x86_64.rpm: emqx-4.2.14-1.el7.x86_64
Marking emqx-centos7-4.2.14-x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package emqx.x86_64 0:4.2.14-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================
 Package         Arch              Version                    Repository                              Size
===========================================================================================================
Installing:
 emqx            x86_64            4.2.14-1.el7               /emqx-centos7-4.2.14-x86_64             37 M

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

Total size: 37 M
Installed size: 37 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : emqx-4.2.14-1.el7.x86_64                                                                1/1 
Created symlink from /etc/systemd/system/multi-user.target.wants/emqx.service to /usr/lib/systemd/system/emqx.service.
  Verifying  : emqx-4.2.14-1.el7.x86_64                                                                1/1 

Installed:
  emqx.x86_64 0:4.2.14-1.el7                                                                               

Complete!

4 运行服务

sudo emqx start
EMQ X Broker 4.2.14 is started successfully!
[root@centos7 ~]# 

5 配置开机自启

5.1 查找开机自启服务

systemctl  list-unit-files |grep emq

5.2 设备为开机自启

systemctl enable emqx

6 开放端口

sudo firewall-cmd --zone=public --add-port=18083/tcp --permanent
sudo firewall-cmd --zone=public --add-port=1883/tcp --permanent

7 重启防火墙

sudo systemctl reload firewalld

在这里插入图片描述

8 界面验证

http://localhost:18083,localhost可以替换为你的云服务器公网IP或者虚拟机IP。登录账号:admin,密码:public。

在这里插入图片描述
在这里插入图片描述

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值