XMPPサーバ(openfire)のインストール

提供: Wikiducca
2012年6月2日 (土) 11:21時点におけるYosuke (ノート | 投稿記録)による版

移動: 案内検索

XMPP【eXtensible Messaging and Presence Protocol】とは

読み :エックスエムピーピー

インスタントメッセンジャー(IM)がメッセージの交換やログイン状況の通知などに使う、XMLベースのプロトコル。2004年1月にIETFによって標準案に認定されている。 もともとJabber社が開発したIMソフト「Jabber」で使われていたプロトコルを改良したもので、セキュリティ機能や国際化機能が追加されている。Jabberは現在では非営利団体Jabber Software Foundationが管理するオープンソースソフトとなっている。 同種のプロトコルとしてはMicrosoft社やIBM社が支持するSIPベースの「SIMPLE」(SIP for Instant Messaging and Presence Leveraging Extensions)プロトコルがある。

openfireとは

各種プラットフォーム対応のXMPPサーバ


ユーザ・グループ作成

※UID,GID は空いてるものを使っただけ。

# groupadd -g 6000 openfire 
# useradd -d /home/openfire -g 6000 -u 6101 openfire  

ダウンロード・展開

tar 版をDLし、/usr/local/openfire にインストールした。
http://www.igniterealtime.org/downloads/download-landing.jsp?file=openfire/openfire_3_7_1.tar.gz

# tar zxvf ./openfire_3_7_1.tar.gz 
# mv openfire /usr/local/openfire 
# chown -R openfire.openfire /usr/local/openfire


MySQL 設定

[root@server ~]# mysqladmin create openfire -p
Enter password:
[root@server ~]#

[root@server ~]# mysql -p

mysql> GRANT ALL ON openfire.* TO openfire_admin IDENTIFIED BY 'openfire';
Query OK, 0 rows affected (0.04 sec)

mysql>

mysql> GRANT ALL ON openfire.* TO openfire_admin@'localhost' IDENTIFIED BY 'openfire';
Query OK, 0 rows affected (0.00 sec)

mysql> SET PASSWORD FOR openfire_admin@"localhost"=password('MyPassWord');
Query OK, 0 rows affected (0.00 sec)

mysql> SET PASSWORD FOR openfire_admin=password('MyPassWord');
Query OK, 0 rows affected (0.00 sec)


[root@server ~]# mysqladmin reload


起動スクリプトの作成

/etc/rc.d/init.d/openfire

#!/bin/sh
#
# chkconfig: 345 85 15
# description: XMPP Server

openfire="/usr/local/openfire/bin/openfire"

case "$1" in
    start|stop|status)
        su -l openfire -c "$openfire $@"
    ;;
    *)
        su -l openfire -c "$openfire"
    ;;
esac

# EOF

パーミッションの変更

# chmod 755 /etc/rc.d/init.d/openfire
# chown root.root /etc/rc.d/init.d/openfire


自動起動の設定

# chkconfig --add openfire
# chkconfig --list openfire
openfire        0:off   1:off   2:off   3:on    4:on    5:on    6:off


自動起動が不要な場合は以下を実行しておく。

# chkconfig openfire off
# chkconfig --list openfire
openfire        0:off   1:off   2:off   3:off   4:off   5:off   6:off


起動・終了・確認

root で、

# /etc/init.d/openfire start
# /etc/init.d/openfire stop
# /etc/init.d/openfire status


初期セットアップ

http://server:9090/setup/index.jsp
1) Language Selection
>> English

2) Server Settings
Domain: server.example.com
Admin Console Port: 9090
Secure Admin Console Port : 9091

3) Database Settings
>> Standard Database Connection 
Database Driver Presets: MySQL
JDBC Driver Class: com.mysql.jdbc.Driver
Database URL: jdbc:mysql://localhost:3306/openfire
Username: openfire_admin
Password: MyPassWord
Minimum Connections: 5
Maximum Connections: 25
Connection Timeout: 1.0 Days

4) Profile Settings
>> Default

5) Administrator Account 
Admin Email Address: [email protected]
Password: MyPassWord

>>> Setup Complete! 


管理画面

http://server:9090
username: admin
password: MyPassWord

で管理画面に入れる。


[Users/Groups] タブの[Create New User] にて、適当に2ユーザを作成し、

チャットができるようになったことを確認。

チャットのテストには、Flash製のXMPPクライアント SparkWeb を使用した。


その他

openfire が使用するポート

5222 		Client to Server 	The standard port for clients to connect to the server. Connections may or may not be encrypted. You can update the security settings for this port.
5223 		Client to Server 	The port used for clients to connect to the server using the old SSL method. The old SSL method is not an XMPP standard method and will be deprecated in the future. You can update the security settings for this port.
9090 		Admin Console 	The port used for unsecured Admin Console access.
7777 		File Transfer Proxy 	The port used for the proxy service that allows file transfers to occur between two entities on the XMPP network.
7070 		HTTP Binding 	The port used for unsecured HTTP client connections.
7443 		HTTP Binding 	The port used for secured HTTP client connections.
3478 & 3479 		STUN Service 	The port used for the service that ensures connectivity between entities when behind a NAT.
5229 		Flash Cross Domain 	Service that allows Flash clients connect to other hostnames and ports.

以上。