Installing Ejabberd on Debian


Install Ejabberd

  • For Debian 9
apt-get -t stretch-backports install ejabberd
  • For Debian 10
apt install ejabberd

Edit /etc/ejabberd/ejabberd.yml

#  - localhost

Let's Encrypt configuration

mv /etc/ejabberd/ejabberd.pem "/etc/ejabberd/backup.pem.$(date +%Y%m%d-%H%M%S)"; cat /root/ /root/ >> /etc/ejabberd/ejabberd.pem; chown ejabberd  /etc/ejabberd/ejabberd.pem;
  • Delete 'mod_s2s_dialback: {}'. This is a deprecated option allowing the use of self-signed certificates s2s
    versioning: true
# mod_s2s_dialback: {}
  mod_shared_roster: {}
  • Reload config
ejabberdctl reload_config

Creating a user from Linux console

ejabberdctl register user password

Opening a public XMPP server

Uses PostgreSQL or MySQL

Do not use Mnesia or SQLite for public XMPP server. The Mnesia base is limited in size to 2GB and can be damaged at any time. The SQLite database is not recommended because it will show worse performance on a public server. Use PostgreSQL or MySQL. Postgresql is better for storing avatars. Mysql is more familiar to most administrators.

apt install erlang-p1-mysql erlang-p1-pgsql

Install and configure PostgreSQL:

root@server:~$ apt install postgresql
root@notebook:~# service postgresql start
root@server:~$ su postgres
postgres@server:~$ cd
postgres@server:~$ createuser xmpp -P; 
postgres@server:~$ createdb xmpp -O xmpp
postgres@server:~$ wget
postgres@server:~$ psql -v ON_ERROR_STOP=on -d xmpp  <

Edit file ejabberd.yml:

auth_method: sql
auth_password_format: scram

sql_type: pgsql
sql_server: "localhost"
sql_database: "xmpp"
sql_username: "xmpp"
sql_password: "password"

sql_pool_size: 10
new_sql_schema: true
default_db: sql

SRV DNS configuration

Need if the ip of your site and the ip of your server are different or you use non-standard port

SRV record	300	IN	SRV	0			1	5222	300	IN	SRV	0			1	5269

A record:

Change ip to your IP-adress	300	IN	A


  • Host your XMPP server to cheap DDoS-protected VPS: KVM & 2GB RAM & 1 Core & 25 GB SSD France & Nederland & UK & Germany Location & Free backup- €3.00/ month