Enrico already wrote about the Why (and the What, Who and When), so I'll just quote his conclusion and move on to the How.
I now have an XMPP setup which has all the features of the recent fancy chat systems, and on top of that it runs, client and server, on Free Software, which can be audited, it is federated and I can self-host my own server in my own VPS if I want to, with packages supported in Debian.
I've decided to install prosody, mostly because it was recommended by the RTC QuickStart Guide; I've heard that similar results can be reached with ejabberd and other servers.
I'm also targeting Debian stable (+ backports); as I write this is jessie; if there are significant differences I will update this article when I will upgrade my server to stretch. Right now, this means that I'm using prosody 0.9 (and that's probably also the version that will be available in stretch).
Installation and prerequisites
You will need to enable the backports repository and then install the packages prosody and prosody-modules.
the "local" configures prosody so that only local users are allowed to create new rooms (but then everybody can join them, if the room administrator allows it): this may help reduce unwanted usages of your server by random people.
You can also add the following line to enable rich media transfers via http uploads (XEP-0363):
Don't forget to enable the virtualhost by linking the file inside /etc/prosody/conf.d/.
Most of the other interesting XEPs are enabled by loading additional modules inside /etc/prosody/prosody.cfg.lua (under modules_enabled); to enable mod_something just add a line like:
Most of these come from the prosody-modules package (and thus from https://modules.prosody.im/ ) and some may require changing when prosody 0.10 will be available; when this is the case it is mentioned below.
mod_carbons (XEP-0280) To keep conversations syncronized while using multiple devices at the same time.
This will be included by default in prosody 0.10.
mod_privacy + mod_blocking (XEP-0191) To allow user-controlled blocking of users, including as an anti-spim measure.
In prosody 0.10 these two modules will be replaced by mod_privacy.
mod_smacks (XEP-0198) Allow clients to resume a disconnected session before a customizable timeout and prevent message loss.
mod_mam (XEP-0313) Archive messages on the server for a limited period of time (default 1 week) and allow clients to retrieve them; this is required to syncronize message history between multiple clients.
With prosody 0.9 only an in-memory storage backend is available, which may make this module problematic on servers with many users. prosody 0.10 will fix this by adding support for an SQL backed storage with archiving capabilities.
mod_throttle_presence + mod_filter_chatstates (XEP-0352) Filter out presence updates and chat states when the client announces (via Client State Indication) that the user isn't looking. This is useful to reduce power and bandwidth usage for "useless" traffic.
I had some problems with the configuration. Hope to save others from long debugging time by adding them here as comment
Initially I had put the mentioned modules at the end of the modules_enabled block of the Prosody config file.. For some reason they never made it to become active and conversation never marked their XEP as available. My final solution was to move them atop the mention of the posix module, now they are all active.
@Tobias this is funny: I have them at the bottom between -- BEGIN ANSIBLE MANAGED MODLIST BLOCK (and the corresponding END) and they work, at least under jessie. I've just upgraded the server to stretch and haven't checked yet that they are all still working.
Maybe there was something else that was commenting them out? I have no idea if there is a block comment syntax in lua.
Anyway, great idea adding the comment here, in case it is useful to somebody else.