0% found this document useful (0 votes)
76 views

Ejabberd Server Setup

The document provides instructions for setting up Erlang, Ejabberd, and TURN servers. It describes downloading, configuring, and installing the software as well as basic administration tasks like adding users and clustering servers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views

Ejabberd Server Setup

The document provides instructions for setting up Erlang, Ejabberd, and TURN servers. It describes downloading, configuring, and installing the software as well as basic administration tasks like adding users and clustering servers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

ERLANG setup

1. Export latest version to a variable

export VER="22.1" (latest version we got)

2. Download the latest erlang version

wget http://erlang.org/download/otp_src_${VER}.tar.gz

3. Unzip the folder

tar -xvzf ./otp_src_${VER}.tar.gz

4. sudo apt-get install build-essential

It will ask permission for additional space. Type Y

5. Check for the Dependencies

sudo apt-get install libssl-dev automake autoconf libncurses5-dev gcc

It will ask permission for additional space. Type Y

6. Go to the unzipped erlang directory

cd otp_src_${VER}/

7. configure the setup file


./configure

8. make

9. make install

10. setup is done . Version check with

erl --version

Ejabberd Setup

1. Export latest version to a variable

export VER="19.09" (latest version we got)

2. Download the latest ejabberd version

wget https://www.process-one.net/downloads/downloads-
action.php?file=/ejabberd/${VER}/ejabberd-${VER}.tgz

3. Unzip the file

tar -xvzf downloads-action.php?file=%2Fejabberd%2F${VER}%2Fejabberd-${VER}.tgz

4. Check the Dependencies

sudo apt-get install libexpat1 libexpat1-dev libyaml-0-2 libyaml-dev erlang openssl zlib1g
zlib1g-dev libssl-dev libpam0g
5. Change the directory

cd ejabberd-${VER}/

6. specify a different location for your installation by specifying a prefix on your configure
command :

./configure --prefix=/opt/ejabberd-server

7. make

8. make install

9. Those files are copied to the directory we specified with our configure command in the
prefix option .cd to that directory and you see your ejabberd installation files :

10. Our ejabberdctl program is stored in the sbin directory.To test that our installation
works ,we can run it and check the status and run of our server :

11. If you go to the /etc/ejabberd directory of your installation you will see a ejabberd.yml
file.This is your configuration file.Open the file with your favorite text editor and add
another served host.This can be any ip address accessible from the outside or any ping-able
domain name. We are using a fake domain to our ip

12 . Register an admin user with the command:

13. To give our users admin privileges we modify the ejabberd.yml config file as follows:
14 . start the server

15. From your browser ,open the address( it is ofcouse your IP address that you use) :

http://IPAddress:5280/admin/

Turn Server Setup

1. Change the Driectory

cd /opt

2. Download the file

wget http://turnserver.open-sys.org/downloads/v4.5.0.6/turnserver-4.5.0.6.tar.gz

3. Unzip the file

tar -xvzf turnserver-4.5.0.6.tar.gz

4. change the directory

cd turnserver-4.5.0.6

5. Check the dependencies

apt-get update

6. apt-get install libssl-dev libevent-dev libsqlite3 make

7. Configure

./configure --prefix=/opt
8. make

9. make install

Configure the Turn Server :

1. cp /usr/local/etc/turnserver.conf.default /usr/local/etc/turnserver.conf

2. edit /etc/rc.local local and add /opt/turnserver-4.5.0.6/bin/turnserver -o -c


/usr/local/etc/turnserver.conf

Before exit 0 to run the program at startup.

the following configuration should be changed

1. external-ip= x.x.x.x ( required only if it is nated )

2. lt-cred-mech

3. realm=ckotha.com

>>to create user ( please restart the instance before creating new user )

1. /opt/turnserver-4.5.0.6/bin/turnadmin -a -b /opt/var/db/turndb -u minhaz -r


ckotha.com -p mist

If the server is behind NAT then the following port range ( min-port to max-port must be
open)

min-port=49152
max-port=65535

Ejabberd Clustering Setup

Adding a node to a cluster

Suppose you have already configured ejabberd on one node named ejabberd01. Let's create an
additional node (ejabberd02) and connect them together.

1. Copy the /home/ejabberd/.erlang.cookie file from ejabberd01 to ejabberd02.

Alternatively you could pass the -setcookie <value> option to all erl commands below.
1. Make sure your new ejabberd node is properly configured. Usually, you want to have
the same ejabberd.yml config file on the new node that on the other cluster nodes.
2. Adding a node to the cluster is done by starting a new ejabberd node within the same
network, and running a command from a cluster node. On the ejabberd02 node for
example, as ejabberd is already started, run the following command as the ejabberd
daemon user, using the ejabberdctl script:
3. $ ejabberdctl --no-timeout join_cluster 'ejabberd@ejabberd01'

This enables ejabberd's internal replications to be launched across all nodes so new
nodes can start receiving messages from other nodes and be registered in the
routing tables.

Removing a node from the cluster :

To remove a node from the cluster, it just needs to be shut down. There is no specific delay
for the cluster to figure out that the node is gone, the node is immediately removed from
other router entries. All clients directly connected to the stopped node are disconnected,
and should reconnect to other nodes.

If the cluster is used behind a load balancer and the node has been removed from the load
balancer, no new clients should be connecting to that node but established connections
should be kept, thus allowing to remove a node smoothly, by stopping it after most clients
disconnected by themselves. If the node is started again, it's immediately attached back to
the cluster until it has been explicitly removed permanently from the cluster.

To permanently remove a running node from the cluster, the following command must be
run as the ejabberd daemon user, from one node of the cluster:

$ ejabberdctl leave_cluster 'ejabberd@ejabberd02'

The removed node must be running while calling leave_cluster to make it permanently
removed. It's then immediately stopped.

Restarting cluster nodes :

Ejabberd Community Server uses mnesia internal database to manage cluster and internode
synchronisation. As a result, you may restart ejabberd nodes as long as there is at least one
running node. If you stop the last running node of a cluster, you MUST restart that node first
in order to get a running service back.

You might also like