How to Set Up Prosody for You and Your Friends

From Nick Faro's Homepage
Revision as of 02:14, 17 March 2021 by Nick (talk | contribs)
Jump to navigation Jump to search

Signal seems to have gone closed-source. I like Signal a lot but there are some legitimate criticisms of it-- I never really minded that it's centralized and not federated, but I really don't want to be using a platform that is (currently) lying to its users and claiming to be free and open-source when it's not. I'm no free software maniac, but it just doesn't feel right. Even though it's end-to-end encrypted, so theoretically a compromised server wouldn't reveal my conversations, I started looking for a different solution.

I've heard a lot about federated, self-hostable protocols like XMPP and Matrix, so I decided to explore if it's feasible to switch my small non-programmer friend group over to a self-hosted XMPP server running on a Raspberry Pi in my house.

The two most popular XMPP servers out there are ejabberd and Prosody. I went with Prosody since I found that it's easier to configure (all the settings are basically perfect out of box) and it's less resource hungry, especially nice for running on a Pi. For the following instructions, I'm going to assume you're using a Debian-based OS since that's what I used.

Step 1: Get a Domain Name

Yeah, if you're self-hosting then you pretty much need to set up a domain name for your server. Sucks, but them's the breaks. I bought a .xyz domain for $1 and pointed it at a No-IP domain, then set up my router to do DDNS with No-IP.

Step 2: Install Prosody

Add Prosody's repository in order to get the latest version.

echo deb $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list

Then install Prosody.

sudo apt-get install prosody

Step 3: Add a VirtualHost for your domain

Open up /etc/prosody/prosody.cfg.lua and scroll down to the very bottom. Add a line like this:

VirtualHost "<your domain>"

Step 4: Enable multi-user-chat

If you want to be able to create group chats, add these lines below your VirtualHost line. "MUC" means Multi-User Chat in XMPP parlance and just means group chats.

Component "conference.<your domain>" "muc"
modules_enabled = {

We now have a usable XMPP server, but it's not complete yet-- we need to enable some plugins which enable some useful features that most people will want.

Step 5: Get the Prosody community modules

A few plugins we need are part of the Prosody community modules repository.

First, install mercurial.

apt-get install mercurial

Then download the community modules repository somewhere. I put it in my home directory but you can put it anywhere.

hg clone prosody-modules

Step 6: Set up the community modules

Since Prosody scans plugin directories for everything, and some modules are part of both the community repository and the default pack-in Prosody collection, they recommend creating a separate folder called prosody-modules-enabled, adding THAT to Prosody's plugin path, and then symlinking the modules you want into the directory. So let's do that for the modules we want to use.

mkdir prosody-modules-enabled
cd prosody-modules-enabled
ln -s ../prosody-modules/mod_cloud_notify
ln -s ../prosody-modules/mod_http_upload
ln -s ../prosody-modules/mod_muc_cloud_notify
ln -s ../prosody-modules/mod_smacks

mod_cloud_notify and mod_mud_cloud_notify enable mobile clients such as ChatSecure, Monal and to send push notifications to your phone when you receive a message.

mod_http_upload enables you to share pictures and files in your chats.

mod_smacks is an enhancement which allows spotty or terminated sessions to be resumed without discarding messages in the queue. This is useful for mobile devices on mobile data networks.

Step 7: Enable the modules

Go back into /etc/prosody/prosody.cfg.lua and set a few things.

Add your prosody-modules-enabled folder to the list of plugin_paths

plugin_paths = { "/home/pi/prosody-modules-enabled" }

Add these 3 lines inside the modules_enabled table:


Enable other modules as you see fit. My complete modules-enabled table looks like this: