Install Ejabberd XMPP Server on Ubuntu 20.04

The
You can download this article in PDF format to support us through the following link.

Download the guide in PDF format

turn off
The

The
The

Ejabberd is an open source XMPP server designed to increase speed and efficiency. The tool is built from scratch, with fault tolerance, easy configuration and scalability. Scaling is the problem of adding additional virtual machines to the cluster. Ejabberd supports authentication modules such as Mnesia, SQL, LDAP or by using external scripts. This article will guide you through the steps required to install Ejabberd XMPP Server on Ubuntu 20.04.

Ejabberd use amnesia (Distributed internal Erlang database) to retain data, but supports other database systems. This includes;

  • SQL database Like MySQL or PostgreSQL
  • NoSQL database Like Riak (also written in Erlang)

Main functions of Ejabberd XMPP server

Ejabberd is designed to be modular to ensure a high level of customization and easy access to required functions.

  • Store and Forward (Offline Message)
  • Contact list (roster) and status
  • One-to-one messaging
  • User status extension: Personal Event Protocol (PEP) and key-in indicator
  • User profile with vCard
  • Group chat: MUC (multi-user chat)
  • Mail archive management (MAM)
  • Mail delivery receipt (aka XEP-184)
  • Privacy settings, through privacy lists and simple block extensions
  • Last activity
  • Indicators and complete command line management
  • Full-featured Web support, with BOSH and Web sockets
  • Stream management to improve message reliability on mobile devices (aka XEP-0198) and many other features.

Step 1: Download the ejabberd binary file

The ejabberd Community Server binaries are available for Linux and Windows. You can use a universal installer script, or you can use an operating system-specific binary package, for example .deb Debian family and .rpm Applies to Red Hat series Linux distributions.

We installed the ejabberd Debian package to our local system-Ubuntu 20.04 computer.

You may need to check ejabberd download page To get the latest version available. As of this update to 20.04:

EJ_VERSION=20.04
wget https://static.process-one.net/ejabberd/downloads/${EJ_VERSION}/ejabberd_${EJ_VERSION}-0_amd64.deb

Confirm that the software package has been downloaded.

$ ls -lh ejabberd_${EJ_VERSION}-0_amd64.deb
-rw-r--r-- 1 root root 18M Apr 30 10:06 ejabberd_20.04-0_amd64.deb

Step 2: Install Ejabberd XMPP Server on Ubuntu 20.04

After downloading the software package, you can use Easy Package manager to install.

sudo apt install ./ejabberd_${EJ_VERSION}-0_amd64.deb

Confirm that Ejabberd XMPP Server is successfully installed on Ubuntu 20.04:

.....
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'ejabberd' instead of './ejabberd_20.04-0_amd64.deb'
The following NEW packages will be installed:
  ejabberd
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/18.5 MB of archives.
After this operation, 28.1 MB of additional disk space will be used.
Get:1 /root/ejabberd_20.04-0_amd64.deb ejabberd amd64 20.04-0 [18.5 MB]
Selecting previously unselected package ejabberd.
(Reading database ... 28241 files and directories currently installed.)
Preparing to unpack .../ejabberd_20.04-0_amd64.deb ...
Unpacking ejabberd (20.04-0) ...
Setting up ejabberd (20.04-0) ...

The installer will perform many operations:

  • Add Yabo Application management by system users
  • Create a home directory for this system user – / opt / ejabberd
  • Start core ejabberd service
$ ls /opt/ejabberd
conf  database  logs
$ getent passwd ejabberd
ejabberd:x:998:998::/opt/ejabberd:/bin/sh

Step 3: Start ejabberd service on Ubuntu 20.04

After the installation is complete, you can start the ejabberd service on Ubuntu 20.04:

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

Reload systemd:

sudo systemctl daemon-reload

Start the service and enable it to start at startup:

sudo systemctl enable --now ejabberd

Make sure the service is started without any errors:

$ systemctl status ejabberd
● ejabberd.service - XMPP Server
     Loaded: loaded (/etc/systemd/system/ejabberd.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2020-05-23 11:31:59 CEST; 4s ago
    Process: 1478 ExecStart=/bin/sh -c /opt/ejabberd-20.04/bin/ejabberdctl start && /opt/ejabberd-20.04/bin/ejabberdctl started (code=exited, status=0/>
      Tasks: 23 (limit: 4567)
     Memory: 53.1M
     CGroup: /system.slice/ejabberd.service
             ├─1526 /opt/ejabberd-20.04/bin/epmd -daemon
             ├─1528 /opt/ejabberd-20.04/bin/beam.smp -K true -P 250000 -- -root /opt/ejabberd-20.04 -progname /opt/ejabberd-20.04/bin/erl -- -home /opt>
             ├─1539 erl_child_setup 65536
             └─1567 /opt/ejabberd-20.04/lib/os_mon-2.4.7/priv/bin/memsup

May 23 11:31:56 ubuntu systemd[1]: Starting XMPP Server...
May 23 11:31:59 ubuntu systemd[1]: Started XMPP Server.

Add ejabberdctl command location to PATH

Find ejabberdctl.

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

Add the path to your .bashrc file.

$ vim ~/.bashrc

Make the following settings – but replace /opt/ejabberd-20.04/bin/ with the version path in the find command:

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

Source file to reflect the new path:

source ~/.bashrc

Step 4: Add the administrator user to Ejabberd

You can add users to ejabberd for administrative purposes.

syntax:

ejabberdctl register    

In my case, I will run the following command:

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

where:

  • Computer fan Is the name of the user to be created.
  • Strong password Is the password associated with the created user.

Edit the ejabberd configuration file to grant administrative rights to the XMPP account you created.

User format:

"[email protected]"

Edit ACL Part and add users.

$ sudo vim /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:
      - "[email protected]"
      - "[email protected]"

Restart the Ejabberd service on Ubuntu:

sudo systemctl restart ejabberd

You can grant administrative privileges to any number of XMPP accounts and accounts in other XMPP servers as needed.

Step 5: Visit ejabberd Web Admin

Web Admin can be accessed via http: // server_ip_address_or_hostname: 5280 / admin /.

Check whether the port is bound:

# ss -tunelp | grep 5280
tcp    LISTEN  0 5  *:5280   *:* users:(("beam.smp",pid=3124,fd=47)) uid:998 ino:66294 sk:8 v6only:0 <->

If you have a ufw firewall, please allow port 5280:

sudo ufw allow 5280

Open the ejabberd Web URL in a browser. Enter the previously configured username and password.

Access to the Ejabberd web console should be displayed.

Install Ejabberd XMPP Server on Ubuntu 20.04

You have successfully installed the Ejabberd XMPP server on Ubuntu 20.04.

The
You can download this article in PDF format to support us through the following link.

Download the guide in PDF format

turn off
The

The
The

Sidebar