centos7 搭建mqtt服务器

使用储存库安装 EMQ X

安装所需要的依赖包
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
使用以下命令设置稳定存储库,以 CentOS7 为例
sudo yum-config-manager --add-repo https://repos.emqx.io/emqx-ce/redhat/centos/7/emqx-ce.repo
安装最新版本的 EMQ X
sudo yum install emqx
查询可用版本

[root@xxx bin]# yum list emqx --showduplicates | sort -r
已加载插件:fastestmirror
已安装的软件包
可安装的软件包
Loading mirror speeds from cached hostfile
* epel: mirrors.njupt.edu.cn
emqx.x86_64 4.0.5-1.el7 emqx-ce-stable
emqx.x86_64 4.0.5-1.el7 @emqx-ce-stable
emqx.x86_64 4.0.4-1.el7 emqx-ce-stable
emqx.x86_64 4.0.3-1.el7 emqx-ce-stable
emqx.x86_64 4.0.2-1.el7 emqx-ce-stable
emqx.x86_64 4.0.1-1.el7 emqx-ce-stable
emqx.x86_64 4.0.0-1.el7 emqx-ce-stable
emqx.x86_64 3.2.7-1.el7 emqx-ce-stable
emqx.x86_64 3.2.6-1.el7 emqx-ce-stable
emqx.x86_64 3.2.5-1.el7 emqx-ce-stable
emqx.x86_64 3.2.4-1.el7 emqx-ce-stable
emqx.x86_64 3.2.3-1.el7 emqx-ce-stable
emqx.x86_64 3.2.2-1.el7 emqx-ce-stable
emqx.x86_64 3.2.1-1.el7 emqx-ce-stable
emqx.x86_64 3.2.0-1.el7 emqx-ce-stable
emqx.x86_64 3.1.2-1.el7 emqx-ce-stable
emqx.x86_64 3.1.1-1.el7 emqx-ce-stable
emqx.x86_64 3.1.0-1.el7 emqx-ce-stable
emqx.x86_64 3.0.1-1.el7 emqx-ce-stable
emqx.x86_64 3.0.0-1.el7 emqx-ce-stable
[root@xxx bin]#

根据第二列中的版本字符串安装特定版本,例如 3.1.0
sudo yum install emqx-3.1.0
直接启动
[root@CwKVmz135893 ~]#
[root@CwKVmz135893 ~]# emqx start
[root@CwKVmz135893 ~]#
systemctl 启动
sudo systemctl start emqx
service 启动
sudo service emqx start
 
查看运行状态
[root@CwKVmz135893 ~]# emqx_ctl status
Node 'emqx@127.0.0.1' is started
emqx 4.0.5 is running
[root@CwKVmz135893 ~]#
配置文件路径
  • 配置文件路径:/etc/emqx
  • 日志文件路径:/var/log/emqx
  • 数据文件路径:/var/lib/emqx
 
使用 rpm 包安装 EMQX
通过 emqx.io 或 github 选择 CentOS 版本,然后下载要安装的 EMQ X 版本的 rpm 包。
安装 EMQ X
$ sudo rpm -ivh emqx-centos7-v3.1.0.x86_64.rpm
启动 EMQ X
直接启动
$ emqx start
emqx 3.1.0 is started successfully!
 
$ emqx_ctl status
Node 'emqx@127.0.0.1' is started
emqx v3.1.0 is running
 
systemctl 启动
$ sudo systemctl start emqx
 
service 启动
$ sudo service emqx start
 
配置文件路径
配置文件路径:/etc/emqx
日志文件路径:/var/log/emqx
数据文件路径:/var/lib/emqx
 

使用 zip 包安装 EMQX

通过 emqx.io 或 github 选择 Centos 版本,然后下载要安装的 EMQ X 版本的 zip 包。
解压程序包
$ unzip emqx-centos7-v3.1.0.zip
 
启动 EMQ X
$ ./bin/emqx start
emqx 3.1.0 is started successfully!
 
$ ./bin/emqx_ctl status
Node 'emqx@127.0.0.1' is started
emqx v3.1.0 is running
 
 
 
 
 
 
 
 
 
 
 
 

原文地址:https://www.cnblogs.com/sea-stream/p/14181994.html