Dead Simple Prosody Chat Server

Prosody is a free and open source software that provides XMPP/Jabber server service for chat or instant messaging. It has multi-domain supports and other XMPP/Jabber features.

Let’s install it, configure it and use it. I’ll be using Ubuntu server 14.04 and Prosody from apt-get.

Upgrade the server and reboot:

sudo apt-get -y update
sudo apt-get -y upgrade
sudo reboot

Please note that you may skip above steps if you know what you’re doing.

Install Prosody:

sudo apt-get -y install prosody

That’s it. Installation is finished. Next is to create SSL certificates and do some basic configuration.

Create self-signed SSL certificate, valid for 10 years, and prepare it for Prosody. In this example I have created 1 set of cert for domain textng.com:

openssl req -new -x509 -newkey rsa:4096 -days 3650 -keyout textng.com.key -out textng.com.crt
openssl rsa -in textng.com.key -out textng.com.crt
chmod 640 *.key *.crt
sudo chown root.prosody *.key *.crt
sudo mv textng.com.* /etc/prosody/certs/
sudo ls -l /etc/prosody/certs/

Repeat creating and preparing more self-signed SSL certificates when you need to. One set of SSL certificate for one domain.

Please note that file permissions, ownership, names and location are important.

Start working on Prosody config files, first the main config file prosody.cfg.lua:

cd /etc/prosody
sudo vi prosody.cfg.lua

On prosody.cfg.lua, add admin XMPP/Jabber ID:

admins = { "admin@textng.com" }

Still on prosody.cfg.lua, set to require encryption for client connection and server to server connection:

c2s_require_encryption = true
s2s_secure_auth = true

Save the file and exit editor.

Next, configure domains. In this example I will configure Prosody to handle 2 domains: textng.com and itmn.co.id. I have previously created 2 sets of self-signed SSL certificates and copy them to /etc/prosody/certs.

Start working on domain config file, copy from example configuration:

sudo cp conf.avail/example.com.cfg.lua conf.d/textng.com.cfg.lua

Find and replace every example.com with textng.com:

sudo sed -i 's/example.com/textng.com/g' conf.d/textng.com.cfg.lua

Edit conf.d/textng.com.cfg.lua:

sudo vi conf.d/textng.com.cfg.lua

On conf.d/textng.com.cfg.lua, enable it:

enabled = true

Repeat the process to add more domains. One config file for one domain.

Restart Prosody and check the status:

sudo /etc/init.d/prosody restart
sudo prosodyctl status
sudo tail -f /var/log/prosody/prosody.log

Add XMPP/Jabber ID for admin:

sudo prosodyctl adduser admin@textng.com

Example of adding 2 more XMPP/Jabber IDs:

sudo prosodyctl adduser anton@textng.com
sudo prosodyctl adduser anton@itmn.co.id

You may add as much XMPP/Jabber IDs as you want to.

Installation and basic configuration of Prosody is finished. You may try to login from XMPP/Jabber client softwares now.

2 thoughts on “Dead Simple Prosody Chat Server

Comments are closed.