CentOS 5.5にejabberdをインストール

VirtualBox (4.1.14 r77440)上にインストールしたCentOS 5.5で試しました。

インストールするejabberdのバージョンは2.1.10です。

ダウンロード

以下のページからLinux x86 32-bits Installer (ejabberd-2.1.10-linux-x86-installer.bin.gz)をダウンロードします。
http://www.process-one.net/en/ejabberd/downloads

インストール

以下にインストーラーの実行方法が記載されています。
https://git.process-one.net/ejabberd/mainline/blobs/raw/v2.1.10/doc/guide.html#htoc5

~# gzip -d ejabberd-2.1.10-linux-x86-installer.bin.gz
~# chmod +x ejabberd-2.1.10-linux-x86-installer.bin
~# ./ejabberd-2.1.10-linux-x86-installer.bin

最初に言語を選択します。日本語はないのでデフォルトの英語にします。

Language Selection

Please select the installation language
[1] Dutch - Nederlands
[2] English - English
[3] French - Français
[4] German - Deutsch
[5] Russian - Русский
[6] Simplified Chinese - 简体中文
[7] Spanish - Español
Please choose an option [2] :

ライセンス(GPLv2)が表示されます。同意します。

Welcome to the ejabberd Setup Wizard.

----------------------------------------------------------------------------
Please read the following License Agreement. You must accept the terms of this 
agreement before continuing with the installation.

Press [Enter] to continue :

... GPLv2 が表示されます ...

Do you accept this license? [y/n]: y

インストール先を指定します。デフォルトのままにします。

Please specify the directory where ejabberd will be installed.

Installation Directory [/opt/ejabberd-2.1.10]:

ドメインを指定します。デフォルトのままにします。

ejabberd server domain

Please enter the desired ejabberd domain name. The domain is the visible attribute that is added to the username to form the Jabber Identifier (for example: user@example.net). This computer must be known on the network with this address name.

ejabberd server domain [localhost.localdomain]:

管理者のユーザ名を指定します。デフォルトのままにします。

Administrator username

Please enter the administrator username for the current ejabberd installation. A Jabber account with this username will be created and granted administrative privileges. Don't use blankspaces in the username. 

Administrator username [admin]:

管理者のパスワードを指定します。

Administrator password

Please provide a password for the administrator user (at least 5 characters).

Administrator password :
Retype password :

クラスタリングについて聞かれます。デフォルトのままにします。

Cluster

Will this node be part of a cluster ? (Please note ejabberd clustering is intended for advanced users).

Cluster [y/N]:

インストールを開始して良いか聞かれます。そのまま進めます。

Setup is now ready to begin installing ejabberd on your computer.

Do you want to continue? [Y/n]:

----------------------------------------------------------------------------
Please wait while Setup installs ejabberd on your computer.

 Installing
 0% ______________ 50% ______________ 100%
 #########################################

インストール完了の表示と、Readmeファイルを見るか聞かれます。Readmeファイルは見ないことにして、これでインストール完了です。

Setup has finished installing ejabberd on your computer.

View Readme file? [Y/n]: n

ejabberdの起動

手動で起動

手動で起動する方法が、マニュアルに以下のように記載されています。

To start and stop ejabberd manually, use the desktop shortcuts created by the installer. If the machine doesn’t have a graphical system, use the scripts ’start’ and ’stop’ in the ’bin’ directory where ejabberd is installed.

https://git.process-one.net/ejabberd/mainline/blobs/raw/v2.1.10/doc/guide.html#htoc5

起動してみます。

~# /opt/ejabberd-2.1.10/bin/start
~# /opt/ejabberd-2.1.10/bin/status
The node ejabberd@localhost is started with status: started
ejabberd 2.1.10 is running in that node

続けて、停止してみます。

~# /opt/ejabberd-2.1.10/bin/stop 
Killed

CentOSの起動時に自動で起動

CentOSの起動時にejabberdが自動で起動される方法が、マニュアルに以下のように記載されています。

On a *nix system, if you want ejabberd to be started as daemon at boot time, copy ejabberd.init from the ’bin’ directory to something like /etc/init.d/ejabberd (depending on your distribution). Create a system user called ejabberd, give it write access to the directories database/ and logs/, and set that as home; the script will start the server with that user. Then you can call /etc/inid.d/ejabberd start as root to start the server.

https://git.process-one.net/ejabberd/mainline/blobs/raw/v2.1.10/doc/guide.html#htoc5
~# cp /opt/ejabberd-2.1.10/bin/ejabberd.init /etc/init.d/ejabberd
~# adduser ejabberd
~# chown -R ejabberd:ejabberd /opt/ejabberd-2.1.10/

/etc/init.dにコピーしたスクリプトで起動してみます。

~# /etc/init.d/ejabberd start
Starting ejabberd...
done.
~# ps ax | grep [e]jabberd
 1884 ?        S      0:00 /opt/ejabberd-2.1.10/bin/epmd -daemon
 1886 ?        Sl     0:00 /opt/ejabberd-2.1.10/bin/beam -K true -P 250000 -- -root /opt/ejabberd-2.1.10 -progname /opt/ejabberd-2.1.10/bin/erl -- -home /home/ejabberd -sname ejabberd@localhost -smp auto -noshell -noinput -noshell -noinput -mnesia dir "/opt/ejabberd-2.1.10/database/ejabberd@localhost" -s ejabberd -ejabberd config "/opt/ejabberd-2.1.10/conf/ejabberd.cfg" log_path "/opt/ejabberd-2.1.10/logs/ejabberd.log" -sasl sasl_error_logger {file,"/opt/ejabberd-2.1.10/logs/erlang.log"}

続けて、停止してみます。

~# /etc/init.d/ejabberd stop
Stopping ejabberd...
Killed
done.

CentOSを再起動してejabberdが自動で起動されるか確認してみます。起動していません。

~# ps ax | grep [e]jabberd
~#

ググッてみて以下のページが見つかりました。
https://support.process-one.net/browse/EJAB-1450

そういえばmysqldなどをchkconfigで自動で起動するかどうか設定した覚えがあります。

~# vi /etc/init.d/ejabberd
~# diff /opt/ejabberd-2.1.10/bin/ejabberd.init /etc/init.d/ejabberd 
1c1,10
< #! /bin/sh
---
> #! /bin/sh 
> #
> # ejabberd	Startup script for the ejabberd XMPP Server
> #
> # chkconfig: - 99 10
> # description:	ejabberd XMPP server
> 
> # Source function library. 
> . /etc/init.d/functions
>
~# chkconfig --add ejabberd
~# chkconfig --list ejabberd
ejabberd       	0:off	1:off	2:off	3:off	4:off	5:off	6:off
~# chkconfig ejabberd on
~# chkconfig --list ejabberd
ejabberd       	0:off	1:off	2:on	3:on	4:on	5:on	6:off

改めてCentOSを再起動してejabberdが自動で起動されるか確認してみます。起動しています。

~# ps ax | grep [e]jabberd
 1786 ?        S      0:00 /opt/ejabberd-2.1.10/bin/epmd -daemon
 1788 ?        Sl     0:00 /opt/ejabberd-2.1.10/bin/beam -K true -P 250000 -- -root /opt/ejabberd-2.1.10 -progname /opt/ejabberd-2.1.10/bin/erl -- -home /home/ejabberd -sname ejabberd@localhost -smp auto -noshell -noinput -noshell -noinput -mnesia dir "/opt/ejabberd-2.1.10/database/ejabberd@localhost" -s ejabberd -ejabberd config "/opt/ejabberd-2.1.10/conf/ejabberd.cfg" log_path "/opt/ejabberd-2.1.10/logs/ejabberd.log" -sasl sasl_error_logger {file,"/opt/ejabberd-2.1.10/logs/erlang.log"}