gloox+openfire+mysql安装配置
2016-11-11 18:05
323 查看
1、下载gloox代码编译
下载地址:http://camaya.net/gloox/
gloox编译需要注意修改config.h.win,具体根据项目需要确定,一下是我的config.h.win
编译过了,可以参考网上例子也可以参考gloox自带例子编写测试程序。
2、安装配置mysql
下载地址:http://www.mysql.com/downloads/
我下载的是mysql-5.6.24-win32.zip免安装版,所以需要解压,自己安装mysql服务
安装之前需要修改my-default.ini,我是复制这个到my.ini,然后修改my.ini的
最好还要在系统环境变量里配置MYSQL_HOME和PATH环境变量,我的是这样的
并将mysql下的bin添加到系统环境变量PATH中去
这样再控制台里可以不用跳转到mysql目录执行mysql命令了
安装mysql:mysqld -install
卸载mysql:mysqld -remove
启动mysql:net start mysql
停止mysql:net stop mysql
如果安装,运行mysql服务的时候出现1067这类错误,一定是配置文件问题,所以千万不要拷贝网上的其他人说的那些配置,然后再mysql目录下的data/admin-PC.err查看错误原因,这个会非常有帮助的。
3、安装配置openfire
下载地址:http://www.igniterealtime.org/projects/openfire/index.jsp
运行openfire目录下的bin/openfire.exe
这时候可能会提示很多错误,一般是因为你没有安装jre或者是jre是64位的,这个时候需要
1)、安装jre或者JDK,去oracle下载,下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
2)、将jre的bin目录添加到系统环境变量PATH中去
3)、如果你安装了64位jre或者jdk,你需要再下载32位jre,并增加EXE4J_JAVA_HOME系统环境变量,如:EXE4J_JAVA_HOME=C:\Program Files (x86)\Java\jre1.8.0_111
这样你基本上可以运行openfire了
因为前面已经安装并启动了mysql服务了
所以可以点击openfire的launch admin按钮安装openfire
在到数据库配置的地方,你需要使用mysql命令先创建好openfire数据库,并执行openfire目录下的resources\database\openfire_mysql.sql脚本命令初始化数据库表、数据项等。这样就可以在openfire的安装向导页面填写你的数据库了,本机的话,一般是localhost。
安装完之后就进入后台登录页面,默认管理员是admin,密码是admin
如果提示登录不上,就关掉opnfire,并重启openfire,进入后台管理页面,再登录
登录成功后,就进入后台管理页面了
4、联调测试:
编写了一个gloox测试程序:
spark登录成功,这里登录的域名填的是安装openfire时的域名
以上就是我配置gloox+openfire+mysql+jre的过程
谢谢
下载地址:http://camaya.net/gloox/
gloox编译需要注意修改config.h.win,具体根据项目需要确定,一下是我的config.h.win
/** * Uncomment whichever lib you have installed. */ /* Uncomment if you have zlib available and want to use it */ // #define HAVE_ZLIB 1 /* Comment out if you don't want to use Win's native TLS functions */ #define HAVE_WINTLS 1 /* Uncomment if you are compiling for Windows 7 or above, or Windows Server 2008 R2 and above, and * want to be able to use Channel Binding (with SASL SCRAM-SHA-1-PLUS). */ // #define HAVE_WINTLS_CHANNEL_BINDING 1 /* Uncomment if you have GnuTLS available and want to use it */ // #define HAVE_GNUTLS 1 /* Uncomment if you have GnuTLS 2.12.0 or above */ // #define HAVE_GNUTLS_SESSION_CHANNEL_BINDING 1 /* Uncomment if you have OpenSSL available and want to use it */ // #define HAVE_OPENSSL 1 /* Uncomment if you have LibIDN available and want to use it */ // #define HAVE_LIBIDN 1 /* Uncomment if you have the getaddrinfo function and want IPv6 support (XP and up) */ // #define HAVE_GETADDRINFO 1 /* Comment out if you don't have windns.h (e.g. if you use an old Platform SDK) */ #define HAVE_WINDNS_H 1 /* Comment out if you don't have the `setsockopt' function. Usually available. */ #define HAVE_SETSOCKOPT 1 #ifdef _MSC_VER #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0400 #endif// #if _WIN32_WINNT<0x0400 #undef _WIN32_WINNT #define _WIN32_WINNT 0x0400 #endif// #define WIN32_LEAN_AND_MEAN #pragma comment( lib, "Dnsapi.lib" ) #pragma comment( lib, "Secur32.lib" ) #pragma comment( lib, "Crypt32.lib" ) #pragma comment( lib, "ws2_32.lib" ) /* The following silences a few C4355 warnings ('this' : used in member initializer list). This is only used with Parser which doesn't do anything with its TagHandler in the ctor, so muting C4355 is safe. */ #pragma warning( disable : 4355 ) /* The following silcences warnings concerning "unsafe" functions (sprintf, strncpy, etc.). They are used in a safe way here, though. */ #pragma warning( disable : 4996 ) #endif
编译过了,可以参考网上例子也可以参考gloox自带例子编写测试程序。
2、安装配置mysql
下载地址:http://www.mysql.com/downloads/
我下载的是mysql-5.6.24-win32.zip免安装版,所以需要解压,自己安装mysql服务
安装之前需要修改my-default.ini,我是复制这个到my.ini,然后修改my.ini的
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the # *** default location during install, and will be replaced if you # *** upgrade to a newer version of MySQL. [mysqld] # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required. basedir = D:\other\mysql-5.6.24-win32 datadir = D:\other\mysql-5.6.24-win32\data # port = 3306 # server_id = ..... # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES这里要注意,千万不要使用网上其他人说的配置,使用并修改官方配置文件才是对的,因为不同版本mysql配置是不一样的。
最好还要在系统环境变量里配置MYSQL_HOME和PATH环境变量,我的是这样的
并将mysql下的bin添加到系统环境变量PATH中去
这样再控制台里可以不用跳转到mysql目录执行mysql命令了
安装mysql:mysqld -install
卸载mysql:mysqld -remove
启动mysql:net start mysql
停止mysql:net stop mysql
如果安装,运行mysql服务的时候出现1067这类错误,一定是配置文件问题,所以千万不要拷贝网上的其他人说的那些配置,然后再mysql目录下的data/admin-PC.err查看错误原因,这个会非常有帮助的。
3、安装配置openfire
下载地址:http://www.igniterealtime.org/projects/openfire/index.jsp
运行openfire目录下的bin/openfire.exe
这时候可能会提示很多错误,一般是因为你没有安装jre或者是jre是64位的,这个时候需要
1)、安装jre或者JDK,去oracle下载,下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
2)、将jre的bin目录添加到系统环境变量PATH中去
3)、如果你安装了64位jre或者jdk,你需要再下载32位jre,并增加EXE4J_JAVA_HOME系统环境变量,如:EXE4J_JAVA_HOME=C:\Program Files (x86)\Java\jre1.8.0_111
这样你基本上可以运行openfire了
因为前面已经安装并启动了mysql服务了
所以可以点击openfire的launch admin按钮安装openfire
在到数据库配置的地方,你需要使用mysql命令先创建好openfire数据库,并执行openfire目录下的resources\database\openfire_mysql.sql脚本命令初始化数据库表、数据项等。这样就可以在openfire的安装向导页面填写你的数据库了,本机的话,一般是localhost。
安装完之后就进入后台登录页面,默认管理员是admin,密码是admin
如果提示登录不上,就关掉opnfire,并重启openfire,进入后台管理页面,再登录
登录成功后,就进入后台管理页面了
4、联调测试:
编写了一个gloox测试程序:
/* * Copyright (c) 2004-2016 by Jakob Schr枚ter <js@camaya.net> * This file is part of the gloox library. http://camaya.net/gloox * * This software is distributed under a license. The full license * agreement can be found in the file LICENSE in this distribution. * This software may not be copied, modified, sold or distributed * other than expressed in the named license agreement. * * This software is distributed without any warranty. */ #include "../client.h" #include "../messagesessionhandler.h" #include "../messageeventhandler.h" #include "../messageeventfilter.h" #include "../chatstatehandler.h" #include "../chatstatefilter.h" #include "../connectionlistener.h" #include "../disco.h" #include "../message.h" #include "../gloox.h" #include "../lastactivity.h" #include "../loghandler.h" #include "../logsink.h" #include "../connectiontcpclient.h" #include "../connectionsocks5proxy.h" #include "../connectionhttpproxy.h" #include "../messagehandler.h" using namespace gloox; #ifndef _WIN32 # include <unistd.h> #endif #include <stdio.h> #include <string> #include <cstdio> // [s]print[f] #if defined( WIN32 ) || defined( _WIN32 ) # include <windows.h> #endif class MessageTest : public MessageSessionHandler, ConnectionListener, LogHandler, MessageEventHandler, MessageHandler, ChatStateHandler { public: MessageTest() : m_session( 0 ), m_messageEventFilter( 0 ), m_chatStateFilter( 0 ) {} virtual ~MessageTest() {} void start() { JID jid( "admin@localhost/gloox" ); j = new Client( jid, "admin" ); j->registerConnectionListener( this ); j->registerMessageSessionHandler( this, 0 ); j->disco()->setVersion( "messageTest", GLOOX_VERSION, "Linux" ); j->disco()->setIdentity( "client", "bot" ); j->disco()->addFeature( XMLNS_CHAT_STATES ); StringList ca; ca.push_back( "/path/to/cacert.crt" ); j->setCACerts( ca ); j->logInstance().registerLogHandler( LogLevelDebug, LogAreaAll, this ); // // this code connects to a jabber server through a SOCKS5 proxy // // ConnectionSOCKS5Proxy* conn = new ConnectionSOCKS5Proxy( j, // new ConnectionTCP( j->logInstance(), // "sockshost", 1080 ), // j->logInstance(), "example.net" ); // conn->setProxyAuth( "socksuser", "sockspwd" ); // j->setConnectionImpl( conn ); // // this code connects to a jabber server through a HTTP proxy through a SOCKS5 proxy // // ConnectionTCP* conn0 = new ConnectionTCP( j->logInstance(), "old", 1080 ); // ConnectionSOCKS5Proxy* conn1 = new ConnectionSOCKS5Proxy( conn0, j->logInstance(), "old", 8080 ); // conn1->setProxyAuth( "socksuser", "sockspwd" ); // ConnectionHTTPProxy* conn2 = new ConnectionHTTPProxy( j, conn1, j->logInstance(), "jabber.cc" ); // conn2->setProxyAuth( "httpuser", "httppwd" ); // j->setConnectionImpl( conn2 ); if( j->connect( false ) ) { ConnectionError ce = ConnNoError; while( ce == ConnNoError ) { ce = j->recv(); } printf( "ce: %d\n", ce ); } delete( j ); } virtual void onConnect() { printf( "connected!!!\n" ); } virtual void onDisconnect( ConnectionError e ) { printf( "message_test: disconnected: %d\n", e ); if( e == ConnAuthenticationFailed ) printf( "auth failed. reason: %d\n", j->authError() ); } virtual bool onTLSConnect( const CertInfo& info ) { time_t from( info.date_from ); time_t to( info.date_to ); printf( "status: %d\nissuer: %s\npeer: %s\nprotocol: %s\nmac: %s\ncipher: %s\ncompression: %s\n" "from: %s\nto: %s\n", info.status, info.issuer.c_str(), info.server.c_str(), info.protocol.c_str(), info.mac.c_str(), info.cipher.c_str(), info.compression.c_str(), ctime( &from ), ctime( &to ) ); return true; } virtual void handleMessage( const Message& msg, MessageSession * /*session*/ ) { printf( "type: %d, subject: %s, message: %s, thread id: %s\n", msg.subtype(), msg.subject().c_str(), msg.body().c_str(), msg.thread().c_str() ); std::string re = "You said:\n> " + msg.body() + "\nI like that statement."; std::string sub; if( !msg.subject().empty() ) sub = "Re: " + msg.subject(); m_messageEventFilter->raiseMessageEvent( MessageEventDisplayed ); #if defined( WIN32 ) || defined( _WIN32 ) Sleep( 1000 ); #else sleep( 1 ); #endif m_messageEventFilter->raiseMessageEvent( MessageEventComposing ); m_chatStateFilter->setChatState( ChatStateComposing ); #if defined( WIN32 ) || defined( _WIN32 ) Sleep( 2000 ); #else sleep( 2 ); #endif m_session->send( re, sub ); if( msg.body() == "quit" ) j->disconnect(); } virtual void handleMessageEvent( const JID& from, MessageEventType event ) { printf( "received event: %d from: %s\n", event, from.full().c_str() ); } virtual void handleChatState( const JID& from, ChatStateType state ) { printf( "received state: %d from: %s\n", state, from.full().c_str() ); } virtual void handleMessageSession( MessageSession *session ) { printf( "got new session\n"); // this example can handle only one session. so we get rid of the old session j->disposeMessageSession( m_session ); m_session = session; m_session->registerMessageHandler( this ); m_messageEventFilter = new MessageEventFilter( m_session ); m_messageEventFilter->registerMessageEventHandler( this ); m_chatStateFilter = new ChatStateFilter( m_session ); m_chatStateFilter->registerChatStateHandler( this ); } virtual void handleLog( LogLevel level, LogArea area, const std::string& message ) { printf("log: level: %d, area: %d, %s\n", level, area, message.c_str() ); } private: Client *j; MessageSession *m_session; MessageEventFilter *m_messageEventFilter; ChatStateFilter *m_chatStateFilter; }; int main( int /*argc*/, char** /*argv*/ ) { MessageTest *r = new MessageTest(); r->start(); delete( r ); return 0; }成功如下:
spark登录成功,这里登录的域名填的是安装openfire时的域名
以上就是我配置gloox+openfire+mysql+jre的过程
谢谢
相关文章推荐
- Openfire+Spark安装配置
- Openfire+Mysql安装
- Openfire+Spark+Spark Web安装配置(一)
- mysql+jdk+tomcat+apache+memcache+openfire+vsftp 源码安装
- Openfire+Spark+Spark Web安装配置(二)
- openfire+mysql+spark的配置心得与基础知识
- CentOS7 安装配置过程 (Apache + SQL+ PHP + SSH + Opensips+Openfire)
- Openfire+Spark+Spark Web安装配置(三)
- Openfire+Spark+Spark Web安装配置(二)
- Openfire+Spark+Spark Web安装配置(一)
- Openfire/XMPP学习之——Openfire的安装、配置
- IOS Socket 05-XMPP开始&安装服务器openfire&安装配置客户端
- Openfire+Spark+Spark Web安装配置 手记(二)
- openfire+spark 在linux下安装,配置
- Openfire+Spark+Spark Web安装配置(配置自己的聊天工具)
- Openfire+Spark+Spark Web安装配置(一)
- Openfire+Spark+Spark Web安装配置
- centos LAMP第三部分php,mysql配置 php配置文件 配置php的error_log 配置php的open_basedir 安装php的扩展模块 phpize mysql配置第二十一节课