Ejabberd is a powerful and open source XMPP (Extensible Messaging and Presence Protocol) server fit for use when developing real-time communication applications such as voice, instant messaging, video chat, online gaming, and many more use cases. Ejabberd is coded in Erlang programming language. Ejabberd uses Mnesia (the distributed internal Erlang database) as its default storage engine but you can also use SQL or NoSQL database server.

Some key features of Ejabberd XMPP Server are:

  • 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.

In this article we shall cover the process of installing Ejabberd XMPP Server on CentOS 7 / RHEL 7 Linux system.

Install Ejabberd XMPP Server on CentOS 7 / RHEL 7

The simplest installation method is from .rpm packages. Follow the steps in the next sections to install and configure Ejabberd XMPP Server on CentOS 7 / RHEL 7

Step 1: Update system

Ensure that you’re working on an updated system.

sudo yum -y update

If you have kernel updates consider rebooting the system.

sudo reboot

Step 2: Install Ejabberd RPM package

Check Ejabberd latest release page to download RPM package to run on your RHEL based systems

At the time of updating this article, the latest release is 23.01. Let’s download it using wget.

EJ_VERSION=23.01
sudo yum -y install wget
wget https://static.process-one.net/ejabberd/downloads/${EJ_VERSION}/ejabberd-${EJ_VERSION}-1.x86_64.rpm

Once the package is downloaded locally on the system, install it by using yum package manager.

sudo yum localinstall ejabberd-${EJ_VERSION}*.x86_64.rpm

Agree to any installation prompt that comes up.

.....
Dependencies Resolved

========================================================================================================================================================================================================
 Package                                      Arch                                       Version                                     Repository                                                    Size
========================================================================================================================================================================================================
Installing:
 ejabberd                                     x86_64                                     23.01-1                                     /ejabberd-23.01-1.x86_64                                      25 M

Transaction Summary
========================================================================================================================================================================================================
Install  1 Package

Total size: 25 M
Installed size: 25 M
Is this ok [y/d/N]: y

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: Start Ejabberd service

Next we start and enable ejabberd service on the system.

sudo systemctl enable --now ejabberd

Confirm if the service is running.

$ systemctl status ejabberd
systemctl status ejabberd
 ejabberd.service - XMPP Server
   Loaded: loaded (/etc/systemd/system/ejabberd.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2023-04-05 17:29:26 UTC; 10s ago
 Main PID: 1611 (ejabberdctl)
   CGroup: /system.slice/ejabberd.service
           ├─1611 /bin/sh /opt/ejabberd-23.01/bin/ejabberdctl foreground
           ├─1624 /opt/ejabberd-23.01/erts-12.3.2.5/bin/beam.smp -K true -P 250000 -- -root /opt/ejabberd-23.01 -progname erl -- -home /opt/ejabberd -- -sname ejabberd@localhost -boot ../releases/2...
           ├─1638 /opt/ejabberd-23.01/erts-12.3.2.5/bin/epmd -daemon
           ├─1642 erl_child_setup 65536
           ├─1663 /opt/ejabberd-23.01/lib/eimp-1.0.22/priv/bin/eimp
           ├─1664 /opt/ejabberd-23.01/lib/eimp-1.0.22/priv/bin/eimp
           ├─1665 /opt/ejabberd-23.01/lib/eimp-1.0.22/priv/bin/eimp
           ├─1666 /opt/ejabberd-23.01/lib/eimp-1.0.22/priv/bin/eimp
           ├─1667 /opt/ejabberd-23.01/lib/epam-1.0.12/priv/bin/epam
           ├─1668 /opt/ejabberd-23.01/lib/os_mon-2.7.1/priv/bin/memsup
           ├─1669 inet_gethost 4
           └─1670 inet_gethost 4

Apr 05 17:29:26 cent7.mylab.io ejabberdctl[1611]: 2023-04-05 17:29:26.386086+00:00 [info] Start accepting UDP connections at [::]:3478 for ejabberd_stun
Apr 05 17:29:26 cent7.mylab.io ejabberdctl[1611]: 2023-04-05 17:29:26.385925+00:00 [info] Start accepting TLS connections at [::]:5223 for ejabberd_c2s
Apr 05 17:29:26 cent7.mylab.io ejabberdctl[1611]: 2023-04-05 17:29:26.386208+00:00 [info] Start accepting TLS connections at [::]:5443 for ejabberd_http
Apr 05 17:29:26 cent7.mylab.io ejabberdctl[1611]: 2023-04-05 17:29:26.386343+00:00 [info] Start accepting TCP connections at [::]:5280 for ejabberd_http
Apr 05 17:29:26 cent7.mylab.io ejabberdctl[1611]: 2023-04-05 17:29:26.386397+00:00 [info] Start accepting TCP connections at [::]:1883 for mod_mqtt
Apr 05 17:29:26 cent7.mylab.io ejabberdctl[1611]: 2023-04-05 17:29:26.386666+00:00 [info] Start accepting TCP connections at 127.0.0.1:7777 for mod_proxy65_stream
Apr 05 17:29:26 cent7.mylab.io ejabberdctl[1611]: 2023-04-05 17:29:26.388382+00:00 [warning] Option 'turn_ipv4_address' is undefined and the server's hostname doesn't resolve to a publi...ing properly
Apr 05 17:29:26 cent7.mylab.io ejabberdctl[1611]: 2023-04-05 17:29:26.621417+00:00 [warning] Description: "Authenticity is not established by certificate path validation"
Apr 05 17:29:26 cent7.mylab.io ejabberdctl[1611]: Reason: "Option {verify, verify_peer} and cacertfile/cacerts is missing"
Apr 05 17:29:30 cent7.mylab.io ejabberdctl[1611]: 2023-04-05 17:29:30.240997+00:00 [error] Failed to request certificate for upload.cent7.mylab.io, proxy.cent7.mylab.io and 2 more hosts: Challenge ...
...

Step 4: Add ejabberd admin user account.

Navigate to ejabberd bin directory.

cd /opt/ejabberd-*/bin

You need an admin XMPP account for accessing the Web Admin dashboard.

username="admin"
password="StrongAdminPassword"

Create admin user with the following commands.

$ sudo ./ejabberdctl register ${username} localhost ${password}
User admin@localhost successfully registered

You may need to replace localhost with your actual server hostname. For hostname you can also use command $(hostname -f) value.

# If it fails try FQDN
$ sudo ./ejabberdctl register ${username} $(hostname -f) ${password}

Use similar approach to add other user accounts to Ejabberd.

sudo ./ejabberdctl register testuser localhost testuserpassword
# OR
sudo ./ejabberdctl register testuser $(hostname -f)  testuserpassword

Edit the ejabberd configuration file to give administration rights to the XMPP account you created /opt/ejabberd/conf/ejabberd.yml

$ sudo vi /opt/ejabberd/conf/ejabberd.yml
acl:
   local:
     user_regexp: ""
   loopback:
     ip:
       - "127.0.0.0/8"
       - "::1/128"
       - "::FFFF:127.0.0.1/128"
   admin:
     user:
       - "admin@localhost"
       - "myadmin@localhost"

You may have to replace localhost with your FQDN. Once done restart ejabberd service.

sudo systemctl restart ejabberd

Step 5: Configure firewall and Access UI

If you have Firewalld active, enable ejabberd UI port on the firewall.

sudo firewall-cmd --add-port=5280/tcp --permanent
sudo firewall-cmd --reload

The Web Admin is now accessible on  http://ip-address:5280/admin/. Open the URL using your favorite browser. Login with full username with domain name, e.g username@yourfqdn.

Ejabberd

In conclusion, Ejabberd is a powerful and flexible XMPP server that can be used for a wide range of real-time communication applications. To learn more check official documentation.

For Ubuntu/Debian users, you can install Ejabberd XMPP server using the guide:

LEAVE A REPLY

Please enter your comment!
Please enter your name here