Debian: Setting up Jabberd2

Step 1: Installing Packages

apt update
apt install jabberd2

Step 2: Initialize Database

While jabberd2 is configured by default to use an sqlite db, it doesn't automatically create the tables it needs to work.

zcat /usr/share/doc/jabberd2/db-setup.sqlite.gz | sqlite3 /var/lib/jabberd2/sqlite.db

Step 3: Concat SSL cert

SSL certs are usually distributed as separate pem and key files, but jabberd2 expects them as one file.

cat /etc/letsencrypt/live/your.domain.invalid/privkey.pem /etc/letsencrypt/live/your.domain.invalid/fullchain.pem > /etc/jabberd2/server.pem

You will probably want to do that as part of a post-renew hook.

Step 4: Set Domain Name

In /etc/jabberd2/sm.xml, set <id> under <local> (around line 77) to your FQDN. In /etc/jabberd2/c2s.xml, set <id> around line 145 to your FQDN, and add the property pemfile='/etc/jabberd2/server.pem'. In /etc/jabberd2/s2s.xml, set <pemfile> to /etc/jabberd2/server.pem. Reload the files using service jabberd2 restart.

Step 5: Forward Ports

If you are behind NAT, forward the TCP ports 5222 and 5269.