Install Ejabberd XMPP Server on Ubuntu 18.04|16.04

Posted on 12 views

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.

Install Ejabberd XMPP Server on Ubuntu 18.04|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.

Before you perform the installation, set correct server hostname

sudo hostnamectl set-hostname ejabberd.example.com
sudo hostnamectl set-hostname ejabberd.example.com --static
logout

You can also update the IP address and hostname in /etc/hosts file.

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="21.12"

Download the Debian package with wget.

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

Step 2: Install ejabberd on Ubuntu 18.04

Install downloaded package using the dpkgcommand:

sudo apt install -f ./ejabberd_$VER-0_amd64.deb

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 uses systemd init system, we need to copy ejabberd.service  to /etc/systemd/system directory.

sudo cp $(sudo find / -name ejabberd.service) /etc/systemd/system

Reload systemd:

sudo systemctl daemon-reload

Start the service and enable it to start on boot:

sudo systemctl enable --now ejabberd

Check status by running:

$ systemctl status ejabberd.service
 ejabberd.service - XMPP Server
     Loaded: loaded (/etc/systemd/system/ejabberd.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2021-12-02 18:28:37 EAT; 10s ago
   Main PID: 92067 (ejabberdctl)
      Tasks: 28 (limit: 9482)
     Memory: 47.0M
        CPU: 3.177s
     CGroup: /system.slice/ejabberd.service
             ├─92067 /bin/sh /opt/ejabberd-
21.07/bin/ejabberdctl foreground
             ├─92084 /opt/ejabberd-21.07/bin/beam.smp -K true -P 250000 -- -root /opt/ejabberd-21.07 -progname /opt/ejabberd-21.07/bin/erl -- -home /opt/ejabberd -- -sname [email protected] -smp e>
             ├─92095 /opt/ejabberd-21.07/bin/epmd -daemon
             ├─92099 erl_child_setup 65536
             └─92122 /opt/ejabberd-21.07/lib/os_mon-2.4.7/priv/bin/memsup

Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:37.997 [warning] No certificate found matching pubsub.ubuntu22
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:37.997 [warning] No certificate found matching conference.ubuntu22
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:37.997 [warning] No HTTP listeners for ACME challenges are configured, automatic certificate requests are aborted. Hint: configure the listener an>
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:37.998 [info] ejabberd 21.07 is started in the node [email protected] in 0.96s
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:38.001 [info] Start accepting TCP connections at [::]:5222 for ejabberd_c2s
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:38.001 [info] Start accepting TCP connections at 127.0.1.1:7777 for mod_proxy65_stream
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:38.002 [info] Start accepting TCP connections at [::]:5269 for ejabberd_s2s_in
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:38.002 [info] Start accepting TLS connections at [::]:5443 for ejabberd_http
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:38.002 [info] Start accepting TCP connections at [::]:5280 for ejabberd_http
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:38.002 [info] Start accepting TCP connections at [::]:1883 for mod_mqtt

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.

Add ejabberdctl command location to your PATH

Locate ejabberdctl.

$ sudo find / -name ejabberdctl
/opt/ejabberd-21.12/bin/ejabberdctl

Add the path of to your .bashrc file.

$ sudo su -
$ vim ~/.bashrc

Set like below – but replace /opt/ejabberd-21.12/bin/ with your version path as found from find command:

PATH=$PATH:/opt/ejabberd-21.12/bin/

Source the file for the new path to be reflected:

source ~/.bashrc

Syntax for user creation.

ejabberdctl register    

In my case, I’ll run the commands below:

# ejabberdctl register computingpost $(hostname) StrongPassword
User [email protected] successfully registered

Where:

  • computingpost is the name of user to be created.
  • $(hostname) gives the system hostname. You can also check set value in /opt/ejabberd/conf/ejabberd.yml file.
  • StrongPassword is the password of the user to be created.

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:
      - "computingpost@ejabberd.example.com"

Where ejabberd.example.com is your server hostname used when adding the user. 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.

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.
Install Ejabberd XMPP Server on Ubuntu 18.04|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.

Before you perform the installation, set correct server hostname

sudo hostnamectl set-hostname ejabberd.example.com
sudo hostnamectl set-hostname ejabberd.example.com --static
logout
You can also update the IP address and hostname in /etc/hosts file.

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=
├─92095 /opt/ejabberd-21.07/bin/epmd -daemon
├─92099 erl_child_setup 65536
└─92122 /opt/ejabberd-21.07/lib/os_mon-2.4.7/priv/bin/memsup

Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:37.997 [warning] No certificate found matching pubsub.ubuntu22
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:37.997 [warning] No certificate found matching conference.ubuntu22
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:37.997 [warning] No HTTP listeners for ACME challenges are configured, automatic certificate requests are aborted. Hint: configure the listener an>
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:37.998 [info] ejabberd 21.07 is started in the node [email protected] in 0.96s
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:38.001 [info] Start accepting TCP connections at [::]:5222 for ejabberd_c2s
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:38.001 [info] Start accepting TCP connections at 127.0.1.1:7777 for mod_proxy65_stream
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:38.002 [info] Start accepting TCP connections at [::]:5269 for ejabberd_s2s_in
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:38.002 [info] Start accepting TLS connections at [::]:5443 for ejabberd_http
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:38.002 [info] Start accepting TCP connections at [::]:5280 for ejabberd_http
Des 02 18:28:38 ubuntu22 ejabberdctl[92084]: 18:28:38.002 [info] Start accepting TCP connections at [::]:1883 for mod_mqtt
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.

Add ejabberdctl command location to your PATH
Locate ejabberdctl.

$ sudo find / -name ejabberdctl
/opt/ejabberd-21.12/bin/ejabberdctl
Add the path of to your .bashrc file.

$ sudo su –
$ vim ~/.bashrc
Set like below – but replace /opt/ejabberd-21.12/bin/ with your version path as found from find command:

PATH=$PATH:/opt/ejabberd-21.12/bin/
Source the file for the new path to be reflected:

source ~/.bashrc
Syntax for user creation.

ejabberdctl register
In my case, I’ll run the commands below:

# ejabberdctl register computingforgeeks $(hostname) StrongPassword
User [email protected] successfully registered
Where:

computingforgeeks is the name of user to be created.
$(hostname) gives the system hostname. You can also check set value in /opt/ejabberd/conf/ejabberd.yml file.
StrongPassword is the password of the user to be created.
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:
– “[email protected]
Where ejabberd.example.com is your server hostname used when adding the user. 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.

install ejabberd ubuntu 18.04 ubuntu 16.04 min
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 ” width=”1024″ height=”429″ />

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 

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.