Installing Prosody XMPP server on a Raspberry Pi

In order to send messages between my Pinephone and the Android phone of missis Mees, I installed an XMPP server on my home server. Here is how I did this.

The technical stuff

First, make shure your Raspberry Pi is up to date.

sudo apt-get update

Than install Prosody.

sudo apt-get install prosody

Verify that Prosody is running.

sudo systemctl status prosody

Test the server by making a connection to it via telnet.

telnet localhost 5222

Now paste the following string into the telnet session and look at the respons.

The response should look something like this:

Upgrade to a TLS connection using STARTTLS.

openssl s_client -connect localhost:5222 -quiet -starttls xmpp

As Prosody uses a self signed certificate, you will see an error messages about this. We will fix this later by using Let's Encrypt certificates.

Paste in the string from before and look at the output. It should look something like this:

Create a test user.

sudo prosodyctl register test localhost test1234

Figure out the base64 authentication string. For our test user this is AHRlc3QAdGVzdDEyMzQ=

printf '\0%s\0%s' 'username' 'password' | openssl base64

Test SASL authentication.

openssl s_client -connect localhost:5222 -quiet -starttls xmpp

Send this string:

Authenticate with this string:

Check respons, which should look something like this:

Delete testuser.

sudo prosodyctl deluser test@localhost

Configure Prodosy.

sudo nano /etc/prodosy/prosody.cfg.lua

Add a virtual domain.

VirtualHost ""
enabled = true

Assuming you already have a web server with Let's Encrypt certificates, make these Let's Encrypt certificates available to Prodosy.

prosodyctl --root cert import /etc/letsencrypt/live

Restart Prosody.

sudo service prosody restart

Set local ip address in /etc/hosts (it should also work with external ip address if router forwards this to the server).

Test it.

openssl s_client -connect -quiet -starttls xmpp -servername

Create some users.

sudo prosodyctl adduser

Make your own account the admin by adding the following text to /etc/prodosy/prosody.cfg.lua

admins = { "" }

If you have a firewall on the server, open ports 5222 and 5269

Forward the above ports from the internet to your server

Now you can install the XMPP clients on the phones and start chatting.

File sharing

Unfortunately, Prosody does not yet support http file upload. I could choose to implement Jingle file transfer, but this standard is not supported by the clients I use. So for now, I am limited to sending text messages only. Http file upload will be implemented in the next major release of Prodosy, which will be 0.12.0.