(Last Updated On: October 1, 2018)

Ejabberd is a powerful and popular open source XMPP server. Ejabberd has been designed from the ground-up with fault-tolerance, easy configurations, and scalability. It is able to utilize resources of multiple clustered machines and can be easily scaled when more capacity is required – By adding more VMs.

Ejabberd enables authenticating users using external or internal databases (Mnesia, SQL), LDAP or external scripts

For storing persistent data, ejabberd uses Mnesia (the distributed internal Erlang database), but you can opt for other storage:

  • SQL databases like MySQL or PostgreSQL
  • NoSQL databases like Riak (also written in Erlang)

Features of Ejabberd XMPP Server

Ejabberd have a modular architecture which allows for high customisability and easy access to the required features, which includes:

  • Store-and-forward (offline messages)
  • Contact list (roster) and presence
  • One-to-one messaging
  • User presence extension: Personal Event Protocol (PEP) and typing indicator
  • User profile with vCards
  • Group chat: MUC (Multi-User Chat)
  • Messaging archiving with Message Archive Management (MAM)
  • Message Delivery Receipts (aka XEP-184)
  • Privacy settings, through privacy list and simple blocking extensions
  • Last activity
  • Metrics and full command-line administration
  • Full feature web support, with BOSH and web sockets
  • Stream management for message reliability on mobile (aka XEP-0198)
    and many many more.

How to install Ejabberd XMPP Server on Ubuntu 18.04 / Ubuntu 16.04

We’re going to install ejabberd from a binary Installer which provides a full-featured ejabberd server without a need for any extra dependencies.

Step 1: Download ejabberd installer.

Go to the ejabberd official download page. Note the latest version of the software.

Export latest version to a variable

export VER="18.09"

Download the Debian package with wget.

wget https://www.process-one.net/downloads/ejabberd/${VER}/ejabberd_${VER}-0_amd64.deb

Step 2: Install ejabberd on Ubuntu 18.04

Install downloaded package using the dpkgcommand

sudo dpkg -i ejabberd_${VER}-0_amd64.deb

See sample output

Selecting previously unselected package ejabberd.
(Reading database ... 168726 files and directories currently installed.)
Preparing to unpack ejabberd_18.09-0_amd64.deb ...
Unpacking ejabberd (18.09-0) ...
Setting up ejabberd (18.09-0) ...

This will place ejabberd init script under /etc/init.d/ejabberd

  • A system user called ‘ejabberd‘ is created
  • ejabberd application directory is /opt/ejabberd. This is a home for the ejabberd user.
  • When ejabberd is started, the processes that are started in the system are beam or beam.smp, and also epmd.

Step 3: Starting ejabberd service

Since Ubuntu 18.04 and Ubuntu 16.04 use systemd init system, we need to copy ejabberd.service  to /etc/systemd/system directory.

$ sudo updatedb
$ sudo locate ejabberd.service
/opt/ejabberd-18.09/bin/ejabberd.service
$ sudo cp /opt/ejabberd-18.09/bin/ejabberd.service /etc/systemd/system

Reload systemd

sudo  systemctl daemon-reload

Start the service and enable it to start on boot

sudo systemctl start ejabberd
sudo systemctl enable ejabberd

Check status by running:

$ sudo systemctl status ejabberd
● ejabberd.service - XMPP Server
   Loaded: loaded (/etc/systemd/system/ejabberd.service; disabled; vendor preset: enabled)
   Active: active (running) since Thu 2018-09-13 23:04:46 EAT; 3s ago
  Process: 32244 ExecStart=/bin/sh -c /opt/ejabberd-18.06/bin/ejabberdctl start && /opt/ejabberd-18.06/bin/ejabberdctl started (code=exited, status=0/
 Main PID: 32290 (beam.smp)
    Tasks: 32 (limit: 4704)
   CGroup: /system.slice/ejabberd.service
           ├─32290 /opt/ejabberd-18.09/bin/beam.smp -K true -P 250000 -- -root /opt/ejabberd-18.06 -progname /opt/ejabberd-18.06/bin/erl -- -home /opt
           ├─32311 erl_child_setup 65536
           ├─32388 inet_gethost 4
           ├─32389 inet_gethost 4
           └─32390 /opt/ejabberd-18.09/lib/os_mon-2.4.4/priv/bin/memsup

Sep 13 23:04:42 ejabberd.computingforgeeks.com systemd[1]: Starting XMPP Server...
Sep 13 23:04:46 ejabberd.computingforgeeks.com systemd[1]: Started XMPP Server.

Step 4: Create ejabberd XMPP admin account.

You need an XMPP account and grant him administrative privileges to enter the ejabberd Web Admin. Register an XMPP account on your ejabberd server.

For example, to create [email protected]account, use:

$ locate ejabberdctl
/opt/ejabberd-18.09/bin/ejabberdctl

Add ejabberdctl command location to your PATH

vim ~/.bashrc

Set like below – but replace /opt/ejabberd-18.09/bin/ with your version path as found by locate

PATH="$PATH:/opt/ejabberd-18.09/bin/"

Source the file for the new path to be reflected

source ~/.bashrc

Then add user

$ ejabberdctl register jmutai ejabberd.example.com StrongPassword 
User [email protected] successfully registered

example.com and ejabberd.example.com should be replaced with correct server hostname.

Edit the ejabberd configuration file to give administration rights to the XMPP account you created.

$ sudo vim /opt/ejabberd/conf/ejabberd.yml
acl:
  admin:
    user:
      - "admin": "example.com"
access:
  configure:
    admin: allow

You can grant administrative privileges to many XMPP accounts, and also to accounts in other XMPP servers.

Step 5: Access ejabberd Web Admin

The Web Admin should be accessible on  http://ip-address:5280/admin/. Open the URL usng your favorite browser.

When logging in, make sure to enter the full JID as username:

[email protected]

The reason that you also need to enter the suffix is due to ejabberd’s virtual hosting support. You can manage several XMPP domains on a single instance.

For more information, read Ejabberd Administration guides 

Related Articles

How to Install Openfire XMPP chat server on Ubuntu 18.04 / Ubuntu16.04