Installing Ejabberd on Debian

From WIKI

Install Ejabberd

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

Edit /etc/ejabberd/ejabberd.yml

hosts:
#  - localhost
   - example.com

Let's Encrypt configuration

mv /etc/ejabberd/ejabberd.pem "/etc/ejabberd/backup.pem.$(date +%Y%m%d-%H%M%S)"; cat /root/.acme.sh/404.city_ecc/404.city.key /root/.acme.sh/404.city_ecc/fullchain.cer >> /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
  mod_roster:
    versioning: true
# mod_s2s_dialback: {}
  mod_shared_roster: {}
  • Reload config
ejabberdctl reload_config

Creating a user from Linux console

ejabberdctl register user example.com 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 https://raw.githubusercontent.com/processone/ejabberd/master/sql/pg.new.sql
postgres@server:~$ psql -v ON_ERROR_STOP=on -d xmpp  < pg.new.sql

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

_xmpp-client._tcp.example.com.	300	IN	SRV	0			1	5222	xmpp.example.com.
_xmpp-server._tcp.example.com.	300	IN	SRV	0			1	5269	xmpp.example.com.

A record:

Change ip 8.8.8.8 to your IP-adress

xmpp.example.com.	300	IN	A	8.8.8.8

Ads

  • 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