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

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


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 -xvzf ejab.tgzcd ejabberd-18.01/

Configure ejabberd

./configure --enable-mysql
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
  • 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

###. ====================
## The 'admin' ACL grants administrative privileges to XMPP accounts.
## You can put here as many accounts as you want.
- "admin@localhost"
## - ""

Finally, Start Ejabberd

ejabberdctl start



The Modern SysAdmin

Shailender Choudhary

Written by


The Modern SysAdmin