From MattWiki
Jump to navigation Jump to search
Developer(s) Process One
Stable release
18.04 / May 1, 2018; 11 months ago (2018-05-01)[1]
Repository github.com
Written in Erlang
Operating system Cross-platform
Type XMPP server
License MIT License[2]
Website ejabberd.im
XMPP Portal
XMPP Servers: Servers Category
XMPP Clients: Clients Category
User Guides: User Guide Category

ejabberd is an XMPP application server, written mainly in the Erlang programming language. It can run under several Unix-like operating systems such as Mac OS X, GNU/Linux, FreeBSD, NetBSD, OpenBSD and OpenSolaris. Additionally, ejabberd can run under Microsoft Windows. The name ejabberd stands for Erlang Jabber Daemon (Jabber being a former name for XMPP) and is written in lowercase only, as is common for daemon software.

ejabberd has been in development since 2002 and is used all over the world to power the largest XMPP deployments. This project is so versatile that you can deploy it and customize it for very large scale, no matter what is your use case.

This incredible power comes with a price. You need to learn how to leverage it. Fortunately, the goal of this website is to get you started on your path to mastery. Whether you are a sysadmin, an architect, a developer planning to extend it, or even a simple XMPP user, we have something for you here.

Installing on Ubuntu

noteThis Page was written with Ubuntu 18.04 LTS in mind, and may not work correctly with other versions or distributions.

Installing Needed Software

Start out by adding the `ejabberd` user and install needed dependencies.

adduser --system --group --home /var/lib/ejabberd --disabled-login ejabberd -q
apt update && apt install -y gcc autoconf automake make clang git erlang expat \
    postgresql libyaml-dev libexpat-dev libssl-dev zlib1g-dev

Configuring ejabberd

Download the ejabberd git.

mkdir -p /var/src/; cd /var/src/; rm -rf ejabberd
git clone https://github.com/processone/ejabberd.git

Compile and install ejabberd.

cd /var/src/ejabberd/ && ./autogen.sh && \
./configure --prefix="" --enable-pgsql --enable-user=ejabberd
make && make install

Next, update ejabberdctl with the systems hostname.

sed -i "s/^ERLANG_NODE=.*/ERLANG_NODE=ejabberd@` hostname -f`/g" /sbin/ejabberdctl

And once complete, start ejabberd.

ejabberdctl start && echo $?

Configuring PostgreSQL

Start by creating a new user named ejabberd

sudo -u postgres createuser --interactive

This will provide the following prompts

Enter name of role to add: ejabberd
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n

Next, create a database named ejabberd

sudo -u postgres createdb ejabberd

Now import the ejabberd postgres database

sudo -u postgres psql ejabberd < /var/src/ejabberd/sql/pg.sql

Configuring eJabberd

Domain Setup

  - "example.com"
  - "example-two.com"
  - "example-three.com"

Managing eJabberd

Adding a new user

ejabberdctl register <user> <domain> <password>
ejabberdctl register alice example.com S3cure9assw0rd

Other Tasks

Install OpenSSL 1.1.1

cd /var/src/
wget https://www.openssl.org/source/openssl-1.1.1.tar.gz
rm -rf openssl-1.1.1; tar -xf openssl-1.1.1.tar.gz; cd openssl-1.1.1/; ./config -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)' && make && make install

Once installed, add OpenSSL to your /etc/environment file and reboot. [3]