How to install Ejabberd 18.01 XMPP Server with Mysql on Ubuntu 16.04

Image for post
Image for post

What is Ejabberd — The name stands for Erlang Jabber Daemon .

Ejabberd is an XMPP application server, written mainly in the Erlang programming language. It can run under several Unix-like operating systems such as Mac OS X, GNU/Linux, FreeBSD, NetBSD, OpenBSD and OpenSolaris.

Why use Ejabberd:

XMPP (Extensible Messaging and Presence Protocol) is a protocol based on Extensible Markup Language (XML) and intended for instant messaging (IM) and online presence detection

Ports which Need to be Open

5280,4560,5299

First of all , SSH into your machine and install the required dependencies

apt-get updateapt-get install make gcc libexpat1-dev libyaml-dev  automake libssl-dev erlang  build-essential libncurses5-dev openssl zlib1g-dev libgd-dev libwebp-dev fop xsltproc unixodbc-dev -y

Download Ejabberd 18.01

cd /optwget -O ejab.tgz https://www.process-one.net/downloads/downloads-action.php?file=/ejabberd/18.01/ejabberd-18.01.tgztar -xvzf ejab.tgzcd ejabberd-18.01/

Configure ejabberd

./configure --enable-mysql
make
make install

Check by running ejabberdctl live

Prepare the database for Ejabberd

  • login to the database server and create a new user with all access to database:
GRANT ALL ON ejabberd.* TO 'ejabberd'@'%' IDENTIFIED BY 'password';CREATE DATABASE ejabberd;flush privileges;
  • Download the schema
wget    https://raw.githubusercontent.com/processone/ejabberd/master/sql/mysql.sql
  • Install the schema in DB
mysql -h localhost/IP_Address -D ejabberd -u ejabberd -p < mysql.sql

Edit the config file /usr/local/etc/ejabberd/ejabberd.yml to make necessary changes:

Change the authentication method:

auth_method: sql

Use mysql for all the modules:

default_db: sql

and Specify the details of database

sql_type: mysql
sql_server: "IP address or RDS endpoint or localhost"
sql_database: "ejabberd"
sql_username: "ejabberd"
sql_password: "password"
## If you want to specify the port:
sql_port: 3306

Register a user

ejabberdctl register admin localhost password_here

Edit the config file /usr/local/etc/ejabberd/ejabberd.yml to make the user admin


###. ====================
###' ACCESS CONTROL LISTS
acl:
##
## The 'admin' ACL grants administrative privileges to XMPP accounts.
## You can put here as many accounts as you want.
##
admin:
user:
- "admin@localhost"
## - "ermine@example.org"

Finally, Start Ejabberd

ejabberdctl start

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store