Center OS 5.5 下安裝 和 配置 Ejabberd 2.1.3

安裝jdknode

安裝mysqlmysql


[root@AY131009193734088795Z src]# cp ncurses-5.6.tar.gz /usr/local/src/sql

[root@AY131009193734088795Z src]# cp ejabberd-2.1.3.tar.gz /usr/local/src/vim

[root@AY131009193734088795Z src]# cp otp_src_R13B04.tar.gz /usr/local/src/tomcat


cd /usr/local/srcbash


yum groupinstall "Development Tools"tcp

yum –y install ncurses-develide

yum install openssl-develspa

yum install expat-devel命令行

yum install unixODBC unixODBC-devel

yum install zlib


tar zxvf ncurses-5.6.tar.gz

cd ncurses-5.6

./configure -prefix=/usr/local/ncurses -with-shared -without-debug

make

make install


tar zxvf otp_src_R13B04.tar.gz

cd otp_src_R13B04

./configure --prefix=/usr/local/erlang

make

make install


vim /etc/profile

在最後一行加上

export PATH=/usr/local/erlang/bin:$PATH

保存退出後

source /etc/profile

命令行中輸入erl看是否安裝成功


tar zxvf ejabberd-2.1.3.tar.gz

cd ejabberd-2.1.3/src/

./configure --prefix=/usr/local/ejabberd --enable-odbc --enable-unicode --with-erlang=/usr/local/erlang

make

make install


修改hostname

vim /etc/sysconfig/network


cd /usr/local/ejabberd/etc/ejabberd

vim ejabberd.cfg

{hosts, ["localhost"]}. 修改成: {hosts, ["wetaxi.cn"]}.

%%{acl, admin, {user, "aleksey", "localhost"}}. 修改成: {acl, admin, {user, "admin", "wetaxi.cn"}}.


vim ejabberdctl.cfg

ERLANG_NODE=ejabberd@wetaxi.cn


hostname wetaxi.cn

/usr/local/ejabberd/sbin/ejabberdctl start --node ejabberd@wetaxi.cn

/usr/local/ejabberd/sbin/ejabberdctl status

/usr/local/ejabberd/sbin/ejabberdctl register admin wetaxi.cn 1234

/usr/local/ejabberd/sbin/ejabberdctl stop


設置開機自啓動

vim /etc/init.d/ejabberd

輸入如下內容

------------------------------------------------------------------------

#!/bin/sh
# chkconfig: 345 99 10
# description: Auto-starts tomcat
# /etc/init.d/ejabberd
# Tomcat auto-start
# Source function library.
#. /etc/init.d/functions
# source networking configuration.
#. /etc/sysconfig/network
RETVAL=0
DIR=/usr/local/ejabberd/sbin
CTL="$DIR"/ejabberdctl
start()
{
        if [ -f $CTL ];
          then
            echo $"Starting Ejabberd..."
                $CTL start
        $CTL started
            RETVAL=$?
        sleep 1
        echo "done."
            return $RETVAL
        fi
}
stop()
{
        if [ -f $CTL ];
          then
            echo $"Stopping Ejabberd..."
                $CTL stop
            RETVAL=$?
            sleep 1
            echo "Ejabberd stoped. "
            return $RETVAL
        fi
}
case "$1" in
 start)
        start
        ;;
 stop) 
        stop
        ;;
                                                  
 restart)
         echo $"Restaring Ejabberd..."
         $0 stop
         sleep 1
         $0 start
         ;;
 *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
        ;;
esac
exit $RETVAL

-----------------------------------------------------------------------------------------

chmod +x /etc/init.d/ejabberd

chkconfig --add ejabberd

chkconfig --level 2345 ejabberd on


設置外網訪問端口

打開5280端口 5222 端口

vim /etc/sysconfig/iptables

-A INPUT -p tcp -m tcp --dport 5222 -j ACCEPT

-A INPUT -p tcp -m tcp --dport 5280 -j ACCEPT


reboot 重啓自動生效

相關文章
相關標籤/搜索