官方教程  :头痛的是nginx 和 mqtt布局有所冲突,后台不能使用需要调整,当然是用 nginx自家的布局没问题,但是要收费

1.由于emqttd是用Erlang语言编写的,所以,在Linux下安装时,需要先安装Erlang。

安装依赖库

sudo yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel

获取源码包

wget http://www.erlang.org/download/otp_src_R13B04.tar.gz

解压、编译、安装

tar xfvz otp_src_R13B04.tar.gz
cd otp_src_R13B04/

/**************************此时开始到下面对接处****************************/

编译此时会出大问题,会提示没有java什么的,需要进行下面操作,

这里主要注意 APPLICATIONS DISABLED 部分的提示,其他两部分是不影响编译的。

jinterface : No Java compiler found 什么?没有java编译器?其实这里我们可以选择用gcc等其他方式来编译erlang。

如果你安装了gcc,这里就用不上java编译了,因此可以在configure时增加 –disable-javac 避免第二个错误;

odbc : ODBC library – link check failed  表示你未安装unixODBC库

好吧,想办法安装下unixODBC:

安装 ODBC

下载unixODBC源码包(http://www.unixodbc.org/unixODBC-2.2.1.tar.gz)放到某处比如/usr/local下,然后运行下述命令:

tar zxvf unixODBC-2.2..tar.gz

  cd unixODBC-2.2.

  ./configure --prefix=/usr/local/unixODBC-2.2. --includedir=/usr/include --libdir=/usr/lib -bindir=/usr/bin --sysconfdir=/etc --enable-gui=no

    make

    make install

紧接着会出现 checking for X... 
configure: error: Can't find X includes

解决方法:

./configure --x-includes=/usr/include/X11

后又出现

checking for X... configure: error: Can't find X libraries. Please check your installation and add the correct paths!

./configure --x-includes=/usr/include/X11 --x-libraries=/usr/lib/X11

/**************************回到最原来的地方****************************/

之后回过头cd到之前的otp_src_R13B04目录

执行

./configure --prefix=/home/erlang --without-javac

make

make install

上一步会出现(正常状况)

*********************************************************************
********************** APPLICATIONS DISABLED **********************
********************************************************************* jinterface : Java compiler disabled by user *********************************************************************
*********************************************************************
********************** APPLICATIONS INFORMATION *******************
********************************************************************* wx : wxWidgets not found, wx will NOT be usable *********************************************************************
*********************************************************************
********************** DOCUMENTATION INFORMATION ******************
********************************************************************* documentation :
xsltproc is missing.
fop is missing.
The documentation can not be built. *********************************************************************

虽然会等待一会,但是最终还是成功了,至少我的是成功了,哈哈

做个ln吧,你要是不想要就不用执行这个命令了.

ln -s /usr/local/erlang/bin/erl /usr/local/bin/erl

设置环境变量以便下一步安装时使用(这个只是临时性的设置)

export PATH=$PATH:/usr/local/erlang/bin/

或者永久设置

编辑/etc/profile文件,然后在最下边加上

gedit /etc/profile

export PATH=$PATH:/usr/local/erlang/bin/

部署EMQ

下载和安装

到这里获取Linux通用安装包:http://emqtt.com/docs/v2/install.html#linux

unzip emqttd-centos7-v2..zip

控制台调试模式启动,检查 EMQ 是否可正常启动:

cd emqttd && ./bin/emqttd console

EMQ 消息服务器如启动正常,控制台输出:

alarm_handler: {set,{system_memory_high_watermark,[]}}
starting emqttd on node 'emq@127.0.0.1'
emqttd ctl is starting...[ok]
emqttd hook is starting...[ok]
emqttd router is starting...[ok]
emqttd pubsub is starting...[ok]
emqttd stats is starting...[ok]
emqttd metrics is starting...[ok]
emqttd pooler is starting...[ok]
emqttd trace is starting...[ok]
emqttd client manager is starting...[ok]
emqttd session manager is starting...[ok]
emqttd session supervisor is starting...[ok]
emqttd wsclient supervisor is starting...[ok]
emqttd broker is starting...[ok]
emqttd alarm is starting...[ok]
emqttd mod supervisor is starting...[ok]
emqttd bridge supervisor is starting...[ok]
emqttd access control is starting...[ok]
emqttd system monitor is starting...[ok]
emqttd 2.3. is running now
Eshell V9. (abort with ^G)
(emq@127.0.0.1)> Load emq_mod_presence module successfully.
dashboard:http listen on 0.0.0.0: with acceptors.
mqtt:tcp listen on 127.0.0.1: with acceptors.
mqtt:tcp listen on 0.0.0.0: with acceptors.
mqtt:ws listen on 0.0.0.0: with acceptors.
mqtt:ssl listen on 0.0.0.0: with acceptors.
mqtt:wss listen on 0.0.0.0: with acceptors.
mqtt:api listen on 0.0.0.0: with acceptors.

CTRL+c关闭控制台。守护进程模式启动:

./bin/emqttd start

状态查询先进入目录

cd /home/emqttd/bin
emqttd_ctl status
http://localhost:8080/status

停止服务

emqttd stop

centos 7 部署 MQTT的更多相关文章

  1. CentOS 7部署flume

    CentOS 7部署flume 准备工作: 安装java并设置java环境变量,在`/etc/profile`中加入 export JAVA_HOME=/usr/java/jdk1.8.0_65 ex ...

  2. CentOS 7部署Kafka和Kafka集群

    CentOS 7部署Kafka和Kafka集群 注意事项 需要启动多个shell脚本交互客户端进行验证,运行中的客户端不要停止. 准备工作: 安装java并设置java环境变量,在`/etc/prof ...

  3. 在centos中部署jenkins

    在centos中部署jenkins,需要的环境:安装jdk,Apache-tomcat 这两步我前面文章里已写,再次忽略 到官网下载最新的jenkins 我这里的是  jenkins.war 把该文件 ...

  4. Centos 上部署 tomcat7

     在 Centos 上部署 tomcat7 搜索tomcat,选下面红色框框的官网 选箭头指着的版本7, 选 tar.gz 格式, 下载完压缩包,使用 ftpx 工具,放在 centos 的 /opt ...

  5. SSM 项目从搭建爬坑到 CentOS 服务器部署 - 速查手册

    SSM 项目从搭建爬坑到 CentOS 服务器部署 - 速查手册 提示: (1)CSDN 博客左边有操作工具条上有文章目录 (2)SSM 指 Spring,Spring MVC,MyBatis Mav ...

  6. CentOS上部署Django+Nginx+Uwsgi环境

    在CentOS上部署Django+Nginx+Uwsgi环境 奇谭  2016-09-01 评论  Linux  python django nginx uwsgi VirtualEnv的作用:创建隔 ...

  7. Linux CentOS下部署Java Web项目

    本文讲解如何在Linux CentOS下部署Java Web项目的步骤. 一.环境准备: (1)Linux CentOS (2)apache-tomcat-9.0.10 (3)XShell 二.启动t ...

  8. CentOS 7 部署 ASP.NET Core 应用程序

    原文:CentOS 7 部署 ASP.NET Core 应用程序 看了几篇大牛写的关于 Linux 部署 ASP.NET Core 程序的文章,今天来实战演练一下.2017年最后一个工作日,提前预祝大 ...

  9. 在CentOS上部署kubernetes1.9.0集群

    原文链接: https://jimmysong.io/kubernetes-handbook/cloud-native/play-with-kubernetes.html (在CentOS上部署kub ...

随机推荐

  1. 部分Linux时区改为东八区的方法

    直接上命令 CentOS: timedatectl set-timezone Asia/Shanghai timedatectl status date Alphine: apk add tzdata ...

  2. IASetIndexBuffer Offset

    这个Offset官方解释是:Offset (in bytes) from the start of the index buffer to the first index to use. 翻译成中文就 ...

  3. tmux的复制粘贴

    tmux有面板的概念,这导致普通终端下的ctrl+shift+C的模式复制出来的文本会串行.如果面板只有一列当然没有问题,但当面板有多列时,复制就会出问题.于是tmux提出了类似vim的复制模式.因此 ...

  4. Authentication 方案优化探索(JWT, Session, Refresh Token, etc.)

    转载自:http://www.jianshu.com/p/5ac8a0e1e5a8

  5. redis优化配置和redis.conf说明(转)

    1. redis.conf 配置参数: #是否作为守护进程运行 daemonize yes #如以后台进程运行,则需指定一个pid,默认为/var/run/redis.pid pidfile redi ...

  6. Hyper-V 怎样拷贝文件至虚拟硬盘并附加到虚拟机上

    对于大文件来说,通过远程桌面拷贝是件麻烦的事情,虽然简单,但速度受限太多,不推荐使用. 我工作中对于大文件的拷贝,通过创建一个新的虚拟硬盘(VHD),再把大文件拷贝至虚拟硬盘中,最后附加到虚拟机上. ...

  7. 浅谈MySQL备份字符集的问题

    1 引子 MySQL备份时选择字符集是一个难题,特别是字符集不定的业务.mysqldump默认使用utf8,而官方也推荐使用utf8.但实际上,对于中文,部分相当一部分gbk编码字符没有对应的unic ...

  8. android studio build.gradle 中的dependencies 的 compile jar文件

    1.其下载之后的存放地址 例如:compile 'com.qiniu:happy-dns:0.2.5' 存放在:.gradle\caches\modules-\files-\c0ee826650468 ...

  9. maven dependencies

    http://maven.apache.org/guides/getting-started/index.html https://maven.apache.org/guides/introducti ...

  10. ④NuPlayer播放框架之Renderer源码分析

    [时间:2016-11] [状态:Open] [关键词:android,nuplayer,开源播放器,播放框架,渲染器,render] 0 导读 之前我们分析了NuPlayer的实现代码,本文将重点聚 ...