mosquitto centos安装配置
周末弄wordpress的Mysql,一不小心把wordpress弄不好了,写了的好几遍文章也没有了,一怒之下,把整个系统重装了,安装了不带任何软件的新系统,重新搭一遍。
0.安装ftp服务器
#yum install vsftpd
#service vsftpd restart
1.安装编译工具
#yum install gcc gcc-c++
#yum install cmake
2.安装mosquitto编译时需要的依赖库
#yum install openssl-devel
#yum install c-ares-devel
#yum install libuuid-devel
3.安装websocket库
mosquitto支持websocket,需要安装websocket库文件。
websocket下载网址https://libwebsockets.org/下载之后,用ftp工具传到centos,解压编译。
#tar -vxf libwebsockets-2.3.0.tar.gz
#cd libwebsockets-2.3.0
#mkdir build
#cd build
#cmake ..
#make
#make install
4.mosquitto下载安装和配置
mosquitto下载地址:http://mosquitto.org/files/source/用ftp工具传到centos,解压配置编译安装。
#tar -vxf mosquitto-1.4.14.tar.gz
#cd mosquitto-1.4.14.tar.gz
修改config.mk文件以使后面编译的mosquitto文件支持websocket。
WITH_WEBSOCKETS:=yes
#make
#make install
修改配置文件,将/etc/mosquitto/下的mosquitto.conf.example重命名为mosquitto.conf来修改一下,
#mv /etc/mosquitto/mosquitto.conf.example /etc/mosquitto/mosquitto.conf
#vim /etc/mosquitto/mosquitto.conf
修改如下:
port 1883
listener 9001
protocol websockets
5.运行测试
启动服务,一般会报错,
# mosquitto -c /etc/mosquitto/mosquitto.conf -d
mosquitto: error while loading shared libraries: libwebsockets.so.11: cannot open shared object file: No such file or directory
是程序执行时找不到libwebsockets的库文件,执行下面的命令为库做一下符号连接,如果出现其他库找不到,也链接一下。
#ln -s /usr/local/lib/libwebsockets.so.11 /usr/lib64/libwebsockets.so.11
再次运行,如果出现Error: Invalid user ‘mosquitto’错误,使用adduser mosquitto添加用户。
订阅,打开另一个终端窗口,运行:
#mosquitto_sub -t topic
打开另一个终端窗口发布主题:
[root@iZjafzbmqur2lzZ ~]# mosquitto_sub -t topic
hello world
hello world
hello world
hello world
hello world
mosquitto centos安装配置的更多相关文章
- 阿里云服务器Linux CentOS安装配置(零)目录
阿里云服务器Linux CentOS安装配置(零)目录 阿里云服务器Linux CentOS安装配置(一)购买阿里云服务器 阿里云服务器Linux CentOS安装配置(二)yum安装svn 阿里云服 ...
- 阿里云服务器Linux CentOS安装配置(九)shell编译、打包、部署
阿里云服务器Linux CentOS安装配置(九)shell编译.打包.部署 1.查询当前目录以及子目录下所有的java文件,并显示查询结果 find . -name *.java -type f - ...
- 阿里云服务器Linux CentOS安装配置(八)nginx安装、配置、域名绑定
阿里云服务器Linux CentOS安装配置(八)nginx安装.配置.域名绑定 1.安装nginx yum -y install nginx 2.启动nginx service nginx star ...
- 阿里云服务器Linux CentOS安装配置(七)域名解析
阿里云服务器Linux CentOS安装配置(七)域名解析 1.购买域名 登录阿里云,左侧菜单点击[域名],然后[域名注册],完成域名购买.(一般首年45元) 2.添加域名解析 在域名列表里点击你的域 ...
- 阿里云服务器Linux CentOS安装配置(六)resin多端口配置、安装、部署
阿里云服务器Linux CentOS安装配置(六)resin多端口配置.安装.部署 1.下载resin包 http://125.39.66.162/files/2183000003E08525/cau ...
- 阿里云服务器Linux CentOS安装配置(五)jetty配置、部署
阿里云服务器Linux CentOS安装配置(五)jetty配置.部署 1.官网下载jetty:wget http://repo1.maven.org/maven2/org/eclipse/jetty ...
- 阿里云服务器Linux CentOS安装配置(四)yum安装tomcat
阿里云服务器Linux CentOS安装配置(四)yum安装tomcat 1.yum -y install tomcat 执行命令后,会帮你把jdk也安装好 2.tomcat安装目录:/var/li ...
- 阿里云服务器Linux CentOS安装配置(三)yum安装mysql
阿里云服务器Linux CentOS安装配置(三)yum安装mysql 1.执行yum安装mysql命令:yum -y install mysql-server mysql-devel 2.启动mys ...
- 阿里云服务器Linux CentOS安装配置(二)yum安装svn
阿里云服务器Linux CentOS安装配置(二)yum安装svn 1.secureCRT连接服务器 2.先创建一个文件夹,用来按自己的习惯来,用来存放数据 mkdir /data 3.yum安装sv ...
随机推荐
- Dedecms V5.7 关于session
在dedecmsv5.7里面使用session的话要注意开启方式!和PHP源码里的使用方式不一样!!! 开启session,前面必须要@ @session_start(); 启动session,前面必 ...
- 使用Metasploit渗透攻击windows系统(二)
后渗透攻击: 介绍常用的一些命令: 查看进程:ps 查看当前进程号:getpid 查看系统信息:sysinfo 查看目标机是否为虚拟机:run post/windows/gather/checkvm ...
- 错误:Bean property 'sessionFactory' is not writable or has an invalid setter method.
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' ...
- 微服务-注册与发现-zookeeper bydasn
目录 一.微服务注册的概述 二.zookeeper2.1 zookeeper安装启动2.2 zookeeper集群搭建2.3 zkcli操作 一.微服务注册概述 在微服务中,有这么一个东西叫服务注册表 ...
- Saiku登录源码追踪.(十三)
Saiku登录源码追踪呀~ >>首先我们需要debug跟踪saiku登录执行的源码信息 saiku源码的debug方式上一篇博客已有说明,这里简单介绍一下 在saiku启动脚本中添加如下命 ...
- 0913_Python初识及变量
1.Python3不需加utf-8,Python必须加utf-82.单行注释用#,多行注释用""" """3.变量:只能由字母.数字.下划线 ...
- JPA问题汇总
JPATools生成的实体类对大小写敏感.如果一个数据库中大小写混乱,生成的实体类也会大小写都有.这种情况会导致HibernateSQL语句查询,每次都会查询第一个大小写字段,所以需要加映射关系.@C ...
- Window服务器 安装 Memcached
官网上并未提供 Memcached 的Window平台安装包,我们可以使用以下链接来下载,你需要根据自己的系统平台及需要的版本号点击对应的链接下载即可: 32位系统 1.2.5版本:http://st ...
- 剑指Offer 50. 数组中重复的数字 (数组)
题目描述 在一个长度为n的数组里的所有数字都在0到n-1的范围内. 数组中某些数字是重复的,但不知道有几个数字是重复的.也不知道每个数字重复几次.请找出数组中任意一个重复的数字. 例如,如果输入长度为 ...
- Day 2: ASP.NET and python trying
ASP.NET and Python/Javascript Many jQuery plugins that are designed and shared for free on the inter ...