Lately I switched from a binary Ejabberd package to a self-built version of Ejabberd on my XMPP server trashserver.net. This was done mainly because the “Debian Backports” repository did not offer the version of Ejabberd that I urgently needed. While the repo was stuck at 20.02, I wanted to provide the users 20.04 to be able to drastically improve the user experience during video calls.
The Debian project’s Ejabberd maintainer was not sure about the final release date of Ejabberd 20.04 in the Backports repo, so I chose for compiling Ejabberd myself to get my hands on the latest version as soon as possible. That would give me the following benefits:
- Ejabberd can be updated independently from any Debian packaging processes / workflows
- I’m able to use the latest patches / updates on GitHub
As soon as the build time package dependencies are clear, the build process it pretty straight forward. By the way: I’m using Ejabberd with PostgreSQL as a backend. The compile process will vary a little bit if you’re utilizing Ejabberd’s Mnesia DB or MySQL.
Prepare build environment
You will need Debian’s official “Buster Backports” repository for some erlang dependencies that we’re going to install. Instructions for activating the Backports can be found here:
Then install the build dependencies:
apt update apt install \ git \ build-essential \ automake \ libssl-dev \ libexpat-dev \ libyaml-dev \ libz-dev apt install -t buster-backports \ erlang-base \ erlang-dev \ erlang-p1-pgsql \ erlang-parsetools \ erlang-os-mon \ erlang-eunit \ erlang-p1-yconf
Download the Ejabberd source code to your home directory and select the latest version (at the time of writing:
git clone git://github.com/processone/ejabberd.git ejabberd cd ejabberd git checkout 20.04
Configure and run build process
Now configure the build as you need it. I’m enabling the PostgreSQL support here. You might want to enable MySQL, instead.
./configure --help will show you all the available configuration flags that might be interesting for your environment.
./autogen.sh ./configure \ --prefix= \ --exec-prefix=/usr/ \ --enable-user=ejabberd \ --enable-pgsql \ --enable-stun \ --enable-zlib \ --enable-new-sql-schema
Now build Ejabberd!
The build process will take some time, but soon you should be presented a terminal windows with no error messages in it.
It is now time to install Ejabberd on the system. Before to that, a new System user for ejabberd is created:
adduser --system --group --home /var/lib/ejabberd ejabberd
You can now type
to install all the files at the right location.
The make process did also create a Systemd service file. We’re installing it to be able to control the XMPP server via Systemd:
cp ejabberd.service /etc/systemd/system/ systemctl daemon-reload systemctl enable ejabberd
As soon as your server is configured in
/etc/ejabberd/ejabberd.yml, start your server using
systemctl start ejabberd
The log file in
/var/log/ejabberd/ejabberd.log should give you valuable information on the startup of Ejabberd. If you experience any problems that you cannot solve yourself, consider checking out the official Ejabberd (XMPP) chat room at:
In case you need an example configuration for inspiration, check out https://github.com/ThomasLeister/trashserver.net-xmpp