centos6.5 mqtt安装
CentOs 6.5 MQTT 安装部署
所需安装包:
libwebsockets-v1.6-stable.tar.gz,mosquitto-1.4.8.tar.gz
1、安装依赖
# yum -y install gcc gcc-c++ openssl-devel c-ares-devel libuuid-devel wget cmake
2、为mosquitto增加websocket支持,需要安装websocket库文件
下载websocket,我用的是 libwebsockets-v1.6-stable.tar.gz,
解压缩:# tar zxfv libwebsockets-v1.6-stable.tar.gz
3、运行 websocket
# cd libwebsockets-v1.6-stable
# mkdir bulid
# cd bulid
# cmake ..
# make && make install
4、安装mosquitto
下载mqtt,我用的是 mosquitto-1.4.8.tar.gz,
解压缩:# tar zxfv mosquitto-1.4.8.tar.gz
5、修改config.mk文件以使后面编译的mosquitto文件支持websocket。
# cd /mosquitto-1.4.8
找到mosquitto-1.4.8目录下的config.mk文件,把config.mk 文件中的 WITH_WEBSOCKETS:=no 改为yes
保存后,执行
# make && make install
# ln -s /usr/local/lib/libwebsockets.so.6 /usr/lib64/libwebsockets.so.6
# groupadd mosquitto
# useradd -g mosquitto mosquitto
6、创建mosquitto.conf、pwfile文件
# cd /etc/mosquitto/
如果该目录下没有mosquitto.conf 和 pwfile
,
执行
# cp mosquitto.conf.example mosquitto.conf
# cp pwfile.example pwfile
然后修改 文件mosquitto.conf ,
并在文件最后加入
7、启动 mqtt
# mosquitto -c /etc/mosquitto/mosquitto.conf
8、测试
需要打开2个窗口
订阅:
发送消息:
如果订阅窗口打印出hello world ,证明MQTT安装成功。
9、错误解决
在安装过程中,或测试过程中可能会遇到错误:
mosquitto_sub: error while loading shared libraries: libmosquitto.so.1: cannot open shared object file: No such file or directory
解决方法:
# cat /etc/ld.so.conf
# echo "/usr/local/lib">>/etc/ld.so.conf
# ldconfig
centos6.5 mqtt安装的更多相关文章
- 最新版CentOS6.5上安装部署ASP.NET MVC4和WebApi
最新版CentOS6.5上安装部署ASP.NET MVC4和WebApi 使用Jexus5.8.1独立版 http://www.linuxdot.net/ ps:该“独立版”支持64位的CentOS ...
- CentOS6.3编译安装Memcached
要用到如下源码包: /usr/local/src/memcached/libevent-2.0.21-stable.tar.gz /usr/local/src/memcached/memcached- ...
- CentOS6.3编译安装Memcached的PHP客户端memcache
在安装Memcached的PHP客户端memcache之前,可先看下先前的工作笔记: PHP5不重新编译,如何安装自带的未安装过的扩展,如soap扩展? 安装PHP的memcache扩展 cd /us ...
- CentOS6.3编译安装Nginx1.4.7 + MySQL5.5.25a + PHP5.3.28
[准备工作] #在编译安装lnmp之前,首先先卸载已存在的rpm包. rpm -e httpd rpm -e mysql rpm -e php yum -y remove httpd yum -y r ...
- 【PHP升级】CentOS6.3编译安装 PHP5.4.38
先前安装的PHP5.3.28(参考:CentOS6.3编译安装Nginx1.4.7 + MySQL5.5.25a + PHP5.3.28),现在准备升级PHP到5.4.38,有如下几个地方需要重新编译 ...
- CentOS6.3 编译安装LAMP(1):准备工作
卸载yum或rpm安装的amp软件 #在编译安装lamp之前,首先先卸载已存在的rpm包. rpm -e httpd rpm -e mysql rpm -e php yum -y remove htt ...
- CentOS6.3 编译安装LAMP(2):编译安装 Apache2.2.25
所需源码包: /usr/local/src/Apache-2.2.25/httpd-2.2.25.tar.gz 编译安装 Apache2.2.25 #切换到源码目录 cd /usr/local/src ...
- CentOS6.3 编译安装LAMP(2):编译安装 Apache2.4.6
Apache官方说: 与Apache 2.2.x相比,Apache 2.4.x提供了很多性能方面的提升,包括支持更大流量.更好地支持云计算.利用更少的内存处理更多的并发等.除此之外,还包括性能提升.内 ...
- CentOS6.3 编译安装LAMP(3):编译安装 MySQL5.5.25
所需源码包: /usr/local/src/MySQL-5.5.25/cmake-2.8.8.tar.gz /usr/local/src/MySQL-5.5.25/mysql-5.5.25.tar.g ...
随机推荐
- 随机生成30道四则运算-NEW
补充:紧跟上一个随机生成30道四则运算的题目,做了一点补充,可以有真分数之间的运算,于是需要在原来的基础上做一些改进. 首先指出上一个程序中的几个不足:1.每次执行的结果都一样,所以不能每天给孩子出3 ...
- Android开发第二阶段(3)
今天:对闹钟代码的按钮事件进行了添加和修改.对监听器的相关应用也有了进一步的了解和深入. 明天:对主界面的代码的优化比如对按钮位置的调节等细节处理.
- VK Cup 2015 - Qualification Round 1 D. Closest Equals 离线+线段树
题目链接: http://codeforces.com/problemset/problem/522/D D. Closest Equals time limit per test3 secondsm ...
- UVALive - 6893 The Big Painting 字符串哈希
题目链接: http://acm.hust.edu.cn/vjudge/problem/129730 The Big Painting Time Limit: 5000MS 题意 给你一个模板串和待匹 ...
- ASP.NET Core 中的 Razor 页面介绍
标题:ASP.NET Core 中的 Razor 页面介绍 地址:https://docs.microsoft.com/zh-cn/aspnet/core/razor-pages/index?view ...
- linux之JDK安装
1.JDK安装 a.卸载JDK (1)卸载默认的JDK 用root用户登陆到系统,打开一个终端输入 # rpm -qa|grep gcj 显示内容其中包含下面两行信息 # java-1.4.2-gcj ...
- CentOS安装crontab及使用方法(转)
CentOS安装crontab及使用方法(转) 安装crontab:[root@CentOS ~]# yum install vixie-cron[root@CentOS ~]# yum ins ...
- php奇葩错误:htmlspecialchars处理中文丢失
$value = "中文中文"; $res = htmlspecialchars($value); 经过这个函数处理之后,$res就直接变成了空的字符串. 奇葩错误啊!后来发现要这 ...
- 我们为什么要使用Spring Cloud?
我们为什么要使用Spring Cloud? 两个需要好好看看: Spring Boot Spring Clude Spring Cloud是一个集成了众多开源的框架,利用Spring Boot的开发便 ...
- vue shorthands
vue shorthands : & @ https://vuejs.org/v2/guide/syntax.html#Shorthands v-for https://vuejs.org/v ...