系统信息,阿里云服务器
安装工具
yum install gcc gcc-c++
yum install openssl-devel
yum install c-ares-devel
yum install libuuid-devel
yum install wget
yum install cmake
yum install build-essential python quilt devscripts python-setuptools python3 
yum install libssl-dev libc-ares-dev uuid-dev daemon openssl-devel
 
下载并编译安装libwebsockets
wget https://libwebsockets.org/git/libwebsockets/snapshot/libwebsockets-2.0.2.tar.gz
tar zxvf libwebsockets-2.0.2.tar.gz
cd libwebsockets-2.0.2
mkdir build
cd build
cmake .. -DLIB_SUFFIX=64
make install
ldconfig
 
修正链接库
vim /etc/ld.so.conf.d/liblocal.conf
/usr/local/lib64
/usr/local/lib
 
ldconfig
 
下载并编译安装mosquitto
wget http://mosquitto.org/files/source/mosquitto-1.4.9.tar.gz
tar -xzvf mosquitto-1.4.9.tar.gz
cd mosquitto-1.4.9
更改configure.mk中
WITH_WEBSOCKETS:=no
WITH_WEBSOCKETS:=yes
make
make install
cp mosquitto.conf /etc/mosquitto
 
修改mosquitto.conf文件
在/etc/mosquitto/mosquitto.conf的Default Listener一节添加如下几行:
运行mosquitto
mosquitto -c /etc/mosquitto/mosquitto.conf
mosquitto -c /etc/mosquitto/mosquitto.conf -v
或mosquitto -c /etc/mosquitto/mosquitto.conf -d
 
本机测试mosquitto
在服务器上新建两个shell,A和B
A 订阅主题:
mosquitto_sub -t topicA
B 推送消息:
mosquitto_pub -t topicA -h localhost -m "topicA test"
 
远程测试
下载安装MQTT.fx,下图设置服务器地址

下图设置订阅的topic

下图是服务器发布,MQTT.fx和本机订阅收到的信息

下图是MQTT.fx发布,服务器上订阅收到的信息

至此已经将MQTT服务器初步搭建成功。感谢网络上的一些文字的帮助

http://www.cnblogs.com/littleatp/p/4835879.html
http://blog.csdn.net/qhdcsj/article/details/45042515
 
 
 
 

./mosquitto_sub: error while loading shared libraries: libmosquitto.so.1: cannot open shared object file: No such file or directory

执行命令:

sudo ln -s /usr/local/lib/libmosquitto.so.1 /usr/lib/libmosquitto.so.1

ldconfig

即可

CentOS 安装Mosquitto及测试的更多相关文章

  1. mosquitto centos安装配置

    周末弄wordpress的Mysql,一不小心把wordpress弄不好了,写了的好几遍文章也没有了,一怒之下,把整个系统重装了,安装了不带任何软件的新系统,重新搭一遍. 0.安装ftp服务器 #yu ...

  2. centos安装netcat TCP UDP测试工具 简称 nc,安全界叫它瑞士军刀

    centos安装netcat 今天安装swoole后,测试UDP服务需要用到netcat,然而百度了很多安装方法,并没有一个好用的.几经尝试,终于安装成功,现在就分享给大家,以供参考. 配置环境:ce ...

  3. CentOS 7 下安装mosquitto

    简介 MQTT(Message Queuing Telemetry Transport,消息队列遥测传输)是IBM开发的一个即时通讯协议,有可能成为物联网的重要组成部分.该协议支持所有平台,几乎可以把 ...

  4. 【推荐】CentOS安装PHP-5.6.4+扩展安装+安全配置+性能配置

    注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. #准备工作# 前段时间PHP官方发布了一个重要的安全升级公告,修复了两个unserialize函数的严重漏洞,目前受影响的版本有: ...

  5. 转: CentOS 安装 SVN1.8 客户端

     from: http://blog.csdn.net/clementad/article/details/46898091 CentOS 安装SVN客户端 标签: subversionrpmcent ...

  6. CentOS安装gitLab服务器

    首先利用gitlab-install-el6.sh安装,比较简单: (出处:http://www.linuxidc.com/Linux/2013-06/85754.htm) 1:如果有条件,提供一台全 ...

  7. 阿里云服务器Linux CentOS安装配置(八)nginx安装、配置、域名绑定

    阿里云服务器Linux CentOS安装配置(八)nginx安装.配置.域名绑定 1.安装nginx yum -y install nginx 2.启动nginx service nginx star ...

  8. 阿里云服务器Linux CentOS安装配置(七)域名解析

    阿里云服务器Linux CentOS安装配置(七)域名解析 1.购买域名 登录阿里云,左侧菜单点击[域名],然后[域名注册],完成域名购买.(一般首年45元) 2.添加域名解析 在域名列表里点击你的域 ...

  9. 阿里云服务器Linux CentOS安装配置(六)resin多端口配置、安装、部署

    阿里云服务器Linux CentOS安装配置(六)resin多端口配置.安装.部署 1.下载resin包 http://125.39.66.162/files/2183000003E08525/cau ...

随机推荐

  1. 安装和测试Kafka(转)

    http://blog.javachen.com/2015/03/17/install-and-test-kafka/# 本文主要介绍如何在单节点上安装 Kafka 并测试 broker.produc ...

  2. 12 个非常实用的 jQuery 代码片段

    jQuery是一个非常流行而且实用的JavaScript前端框架,本文并不是介绍jQuery的特效动画,而是分享一些平时积累的12个jQuery实用代码片段,希望对你有所帮助. 导航菜单背景切换效果 ...

  3. ORA-00942 表或视图不存在

    场景:跨scheme创建视图,提示ORA-00942 表或视图不存在 1. 创建两个用户 CREATE USER ODI_SRC IDENTIFIED BY ODI_SRC CREATE USER O ...

  4. .NET Core 全新认识

    来源:yubinfeng cnblogs.com/yubinfeng/p/6626694.html 一.概述      .NET 经历14年,在Windows平台上的表现已经相当优秀,但是“跨平台.开 ...

  5. django之创建第6-2个项目-过滤器列表

    转载:http://www.lidongkui.com/django-template-filter-table 一.转化为小写 {{ name | lower }} 二.串联:先转义文本到HTML, ...

  6. DLib库Base64编解码示例

    代码 #include <iostream> #include <fstream> #include <sstream> #include <string&g ...

  7. POJ1013 称硬币

    题目链接:http://poj.org/problem?id=1013 题目大意 有12枚硬币.其中有11枚真币和1枚假币.假币和真币重量不同,但不知道假币比真币轻还是重.现在,用一架天平称了这些币三 ...

  8. Retrofit使用指南

    Retrofit is a type-safe HTTP client for Android and Java. Retrofit是面向Android和Java平台的一个类型安全的HTTP客户端. ...

  9. 用FireBreath来编写跨浏览器插件

    这是对于公司某个需求的临时研究,最后经过简单实验放弃了这个方案,因为编写插件不能满足需求. 下面着重讲一下FireBreath编译. 首先根据文档,用git clone下载Firebreath源码(不 ...

  10. [转载]在VirtualBox中收缩虚拟磁盘映像文件

    原文地址:在VirtualBox中收缩虚拟磁盘映像文件作者:bobby 由于经常要测试一些软件,我在VirtualBox虚拟机中安装了一套Windows.使用过虚拟机的朋友都知道,为了节省硬盘空间,一 ...