Compiling Fresh XMPP Ejabberd Server Binaries 22.05 on Ubuntu 20.04 with Erlang OTP 24

Creating and host your own end-to-end encryption Instant Messenger app

Compiling ejabberd v22.05

A XMPP server based on Erlang/OTP 24

Note 1: I personally took it upon myself to use the following format [Example-Reference] to tag references.

In this article, I will be sharing a HOWTO create your own end-to-end encrypted instant messenger(IM) XMPP service for your Company, family xor community. Having ownership of your data requires work and this setup allows any Human in the world to protect their digital data from those who sell it for profit.

“Ejabberd is a complete open-source XMPP-based messaging solution that is for all human beings, but ideal for governments, police, military, banks, insurance, finance, and healthcare companies that value privacy and security.”

The minimal cost is less than $100 per year and is portable with the nifty config option -with-rebar; this option packages the whole app for transport.

Configure & compile Ejabberd

Please see [Ejabberd Configure] for setting up your Linux environment.

Requirements

Operating System

  • This article is tested with cat /etc/os-release VERSION=”20.04.4 LTS (Focal Fossa)”

Dependencies:

  • GNU Make make -v
  • GCC sudo apt install build-essential && gcc -v
  • Libexpat 1.95 or higher sudo apt install -y expat && libexpat-dev
  • Libyaml 0.1.4 or higher sudo apt install -y libyaml-dev
  • Erlang/OTP 19.3 or higher. We recommend using Erlang OTP 21.2. sudo apt install -y erlang && erl -v
  • OpenSSL 1.0.0 or higher, for STARTTLS, SASL and SSL encryption. sudo apt install -y libssl-dev
  • Zlib 1.2.3 or higher. Optional. For Zlib Stream Compression sudo apt install -y zlib1g && zlib1g-dev

ImageMagick’s Convert program and Ghostscript fonts. Optional. For CAPTCHA challenges. sudo apt install -y imagemagick

  • PAM library. Optional. For PAM Authentication
  • Elixir 1.10.3 or higher. Optional. For Elixir Development

Extras Deps I needed

  • PostgreSQL sudo apt install -y postgresql postgresql-contrib && sudo systemctl start postgresql.service
  • Erlang-dev I had too also install erlang-dev for erl_nif.h was missing sudo apt install -y erlang-dev
  • eunit_autoexport was missing at compile sudo apt-get install -y erlang-eunit
  • erlang-parsetools was needed to create and assemble the 22.05.tar.gz. sudo apt-get install -y erlang-parsetools

Clone Ejabberd 22.05

git clone https://github.com/processone/ejabberd.git && cd ejabberd
git checkout tags/22.05 -b branch-name-example && git status

Note 2-3: the latest stable release is 22.05 on June 21, 2022. Verify you are on branch-name-example.

We begin compiling and installng ejabberd after the environment is ready

Below, I had to create my configure file with autogen. The configure options I have included are: postgresql database (default: mysql), zlib compression algos (optional), extra dev tools (optional) and rebar for packaging everything into one portable app.(optional) To see more options, please visit: Ejabberd Configure

./autogen.sh
./configure --enable-pgsql --with-rebar=rebar3 --enable-tools --enable-zlib --enable-debug
make rel

Note 4-6: if you want to clean up the make after errors, use make distclean for dev files and clean for binaries. You are also able to see all the options for make via make help. Make rel creates a static portable binary release; no need to sudo make install, simply launch the app from the directory.

Eureka! :party-hat

===> Release successfully assembled: _build/prod/rel/ejabberd
===> Building release tarball ejabberd-22.05.tar.gz...
===> Tarball successfully created: _build/prod/rel/ejabberd/ejabberd-22.05.tar.gz

Prepare Ejabberd Binary

After we have successfully compiled ejabberd binaries on our own system, we have a system to create fresh binaries that are portable on the fly! Furthermore, we rename the ejabberd folder to ejabberd_builder and copy the created tar.gz to desired location.

cd .. && mv ejabberd ejabberd_builder
cp _build/prod/rel/ejabberd/ejabberd-22.05.tar.gz ~/nodes/

Launch Ejabberd

Next, we untar or extract the data into the appropriate directory.

cd ~/nodes/ && mkdir ejabberd-20.05
tar -xvkf ejabberd-20.05.tar.gz -C ./ejabberd-20.05
cd ejabberd-20.05/ && ls bin/
./bin/ejabberdctl start
./bin/ejabberdctl status

NOW, the hard part… configuration of your fresh ejabberd binaries.

As you may have noticed, ejabberdctl status failed to start. This is because we now have to configure the server.

PART II - TBA

Financial Support & Donations

I mainly debug code, drive, yak shave and deep dive into research for Linux base operating systems.

I am a Free Software Associate (FSF), privacy advocate and Cosmopolitan that enjoys philosophie, meta-physics, hacking and debugging computer hardware/software.

https://liberapay.com/oDinZu/

References:

CharlesCharles