Request Demo

Procedure to Install, Setup Erlang & Ejabberd XMPP Server on Ubuntu

Published On November 30th, 2023 2388Communication

How to Install and Setup Erlang on Ubuntu?

Erlang is a general-purpose functional programming language and open source used for real-time scalability and high availability at the time of system requirement. It has inbuilt support for concurrency, distribution and fault tolerance. Erlang widely used in many industries like instant messaging, automobile, eCommerce, banking etc.

The following steps are the installation procedure of Erlang in the Ubuntu server:

STEP 1: Download the Erlang in the Ubuntu Server

In Linux server, download the Erlang source file using the below link. Here Erlang version of 18.0 is used and this extends the updates regularly.

The wget command is used to download the Erlang source files.

$ wget http://erlang.org/download/otp_src_18.0.tar.gz

STEP 2: Extract the Erlang tar File

Extract the downloaded tar file using the command.

$ tar -xvzf otp_src_18.0.tar.gz

STEP 3: Adding Dependencies in the Command

Provide the required dependencies in the single library function to perform a specific task. Below listed are the dependencies that will do a certain task.

$ sudo apt-get install gcc make build-essential libncurses5-dev openssl libssl-dev fop xsltproc unixodbc-dev libwxbase3.0 libwxgtk3.0-dev libqt4-opengl-dev autoconf

STEP 4: Start Compilation and Install the Erlang

To compile the source code use “make” command that starts to execute the file and finally install the Erlang using “make install” on the Linux server. The configure command will help you to verify the dependencies.

$ sudo ./configure 
$ sudo make
$ sudo make install

The mentioned steps are the simple way to install the Erlang program on the Ubuntu Server.

Read : How to Build Chat App like WhatsApp?

How to Install and Start Ejabberd XMPP Server on Ubuntu?

Ejabberd is an XMPP (Extensible Messaging Presence Protocol) programming server written using Erlang programming language. One of the most popular open sources and free software. Ejabberd runs on multiple operating systems like Linux, Mac, Unix, Windows etc. XMPP is the backbone that allows to send real-time messages, online presence indicators, XML routing features and more.

Upcoming section will explain the installation of Ejabberd XMPP server on Ubuntu 14.04/16.04 in detail.

STEP 1: Download the Ejabberd in the Ubuntu Server

In Linux server, download the Ejabberd source file using the below link. Here Ejabberd version of 16.08 is used and this extends the updates regularly.

The wget command is used to download the Ejabberd source files.

$ wget https://www.process-one.net/downloads/ejabberd/16.08/ejabberd-16.08.tgz

STEP 2: Extract the Ejabberd tar File

Extract the downloaded tar file using the command.

$ tar -xvzf ejabberd-16.08.tgz

STEP 3: Adding Dependencies in the Command

Provide the required dependencies in the single library function to perform a specific task. Below listed are the dependencies that will do a certain task.

$ sudo apt-get install rebar libyaml-dev libexpat1-dev

STEP 4: Fix and Verify the Issue

autogen.sh used for compilation, verification of the functionality and overcome the initial issues.

$ ./autogen.sh

STEP 5: Start Execution and Install the Ejabberd

To compile the source code use “make” command that starts to execute the file and finally install the Erlang using “make install” on the Linux server. The configure command will help you to verify the dependencies.

$ sudo ./configure 
$ sudo make
$ sudo make install

STEP 6: Open the Ejabberd Configuration File

Using the command, open the Ejabberd file to set the database.

$ sudo nano /etc/ejabberd/ejabberd.yml

If you need MySQL database follow the mention command to enable the IP, Database name, User name, Password.

1) Comment the following lines in ejabberd.yml file

    #auth_method: internal

2) Uncomment the following lines in ejabberd.yml file

    auth_method: sql

    sql_type: mysql

    sql_server: “52.13.12.123″ (Mysql Database IP)

    sql_database: “databasename” (Database name)

    sql_username: “root” (Database user name)

    sql_password: “password” (Database password)

Finally, save the file /etc/ejabberd/ejabberd.yml

STEP 7: Run the Ejabberd

Once the changes are done, run the Ejabberd which in turn helps to refresh the database.

$ sudo ejabberdctl start

STEP 8: Check the Status using Local Host

To verify and to check the status of the ejabberd installation use the below command.

$ sudo ejabberdctl status

The node Ejabberd at Localhost starts with the status command and shows the ejabberd 16.08 is running

Using a localhost IP http://localhost:5222 the browser displays the XML.

The above steps are easy ways to install and start running the Ejabberd program in XMPP on the Ubuntu.

After the installation of Ejabberd, use the open source XMPP client libraries for Web – strophe JS, Android – Smack JAVA, and iOS – Robbiehanson for developing the chat application.

In order to build and implement a messaging app, various features are required such as One to One chat, group chat, audio/video calling and much more. Try Contus Fly to avoid complexity in building a chat app on your own.

Alexander

Alex Sam is a mobility, IoT & chat app specialist and I would like to spend most of my time in reading and analyzing the latest happenings in the technology and how they fit into our daily lives. I always endeavor to identify more ideas and concepts, and develop user-friendly apps through leveraging technology.

3 Comments

  1. chegekhan says:

    Useful Information, your blog is sharing unique information.
    Thanks for sharing!!!

  2. Cholan says:

    Is it important to use turnkey Ejabberd on Amazon EC2 or can we install it ourselves on AMI running Linux?

  3. Nihitan says:

    I want to build an ios chat app using ejabberd as backend.

Leave a Reply

Your email address will not be published. Required fields are marked *