Install and configure Prosody XMPP (Jabber) server on Debian/Ubuntu Linux based operating system

Prosody XMPP/Jabber logoI've been working on my Ajax chat system Quick Chat for WordPress for a while now. With Quick Chat I'm using technique called long polling to turn Apache Web server into chat server. This approach works fine most of the time when there aren't many concurrent chat users and server load is moderate. The reason for this is that Apache Web server is tuned for serving HTML. Better way of handling chat on your page is to install dedicated chat server software using XMPP (Jabber) protocol. This is protocol is used by big players like Gogole as well as Facebook for their chat services. XMPP is open protocol with many open source server and client implementations. In this article I will show you how to install and configure Prosody XMPP (Jabber) server on Debian/Ubuntu Linux based operating systems.

Prosody XMPP server installation

In this article I will install Prosody XMPP server on my trustworthy Ubuntu 10.04 Lucid Lynx server. To be able to do this I will need to add Prosody project repository to my Ubuntu installation. If you are using more up to date Debian/Ubuntu versions you wont have to add any additional repositories because everything you need is inside standard repositories. Here's how to add prosody repository to your APT:

sudo echo deb lucid main | sudo tee -a /etc/apt/sources.list
wget -O- | sudo apt-key add -
sudo apt-get update

You can replace "lucid" with your Debian or Ubuntu distribution name:

Debian based Linux distributions
  • stable
  • unstable
  • sid
  • etch
  • lenny
Ubuntu based Linux distributions
  • hardy
  • lucid
  • natty

Now lets install Prosody and its libraries. If are using your distributions repository packages instead of Prosody project repository, package names might differ so please use your package manager to search for them.

sudo apt-get install prosody liblua5.1-sec0 liblua5.1-event-prosody0

If that went fine you can proceed to Prosody XMPP server configuration.

Prosody XMPP server configuration

After installation you need to configure your installation. First lets create first user account. To configure Prosody correctly you will need to provide domain or IP address for your XMPP server. You can use, localhost, or your server hostname if you plan to connect to this XMPP server only from server it self. I will use my hostname.local (marko-desktop.local) here, this way anyone can use this server from my local network. I could also use my LAN IP address here. Here's how to create XMPP user "marko@marko-desktop.local":

sudo prosodyctl adduser marko@marko-desktop.local

To delete this user you could use following

sudo prosodyctl deluser marko@marko-desktop.local

You can open prosodyctl manual page (man prosodyctl from terminal) to learn more about this utility. Now lets open prosody configuration file with our favorite text editor like this:

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

First thing we will configure is admin user. We must provide XMPP name of our admin users to Prosody because this users have special powers. For example admin user can delete other users right from his XMPP client like Pidgin. So I will modify my prosody.cfg.lua file with this:

admins = { "marko@marko-desktop.local" }

Please keep in mind that lines I will be mentioning here already exist somewhere in prosody.cfg.lua file. To uncomment existing line remove "--" sign in front of it. By modifying this line I've turned marko@marko-desktop.local user as admin user. You can create more users using prosodyctrl or if you want your Prosody server to automatically create new account when new user tries to connect you can modify following line:

allow_registration = true;

With Prosody you can have multiple XMPP servers attached to multiple domains. Because of that you need to add your selected domain/hostname/IP address to virtual hosts variable by modifying following line:

VirtualHost "marko-desktop.local"

If you have installed liblua5.1-event-prosody0 package during installation part of this article I recommend that you enable following to make your XMPP server more responsive:

use_libevent = true;

XMPP is open standard and its core supports basic stuff like one on one chat. Other functionality is usually included trough modules. Some Prosody modules implement official extensions to XMPP protocol (usually called XEP - XMPP extenson) whose list is available here. You can also create your own modules or get them from Prosody modules repository page. Your own modules and modules from modules repository should be placed inside /usr/lib/prosody/modules/ directory. You enable and disable official as well as additional modules by modifying modules_enabled = {} and modules_disabled = {} lines in prosody.cfg.lua. Keep in mind that Prosody is written in Lua programming language.

Inside prosody.cfg.lua under your virtual host you can assign this host a certificate for TLS by modifying ssl = {} lines if you require secure communication. Its nice to know that some XMPP clients like Pidgin by default require encryption but this can usually be overridden easily in your XMPP account settings in those XMPP clients.

Last configuration directive worth mentioning is Multi-User Chat as described by XEP-0045. If you intend to use this feature for your virtual host you need to configure it like this:

Component "conference.marko-desktop.local" "muc"

Where "conference.marko-desktop.local" is a JabberID for your Multi-User Chat service.

When you are done with your Prosody XMPP server configuration you should restart it to apply your settings:

sudo service prosody restart

If something went wrong with parsing you configuration file you will be informed after restarting Prosody service.

Now you can proceed to your favorite XMPP client like Pidgin and create account with user name and password you have provided to prosodyctrl and with domain name you have assigned to your prosody.cfg.lua VirtualHost. If you haven't provided TLS certificate to Prosody configuration file don't forget to change "Require encription" into "Use encryption if available" on advanced tab from Pidgin create account dialog. If you are web developer please check back soon for my next article where I will explain how to configure Prosody for XMPP server access from Javascript using Bidirectional-streams Over Synchronous HTTP (BOSH).


A quality focused Magento specialized web development agency. Get in touch!

6 thoughts on “Install and configure Prosody XMPP (Jabber) server on Debian/Ubuntu Linux based operating system

  1. hipo

    I’ve never used prosody my experience is with running ejabberd.
    jabber is a nice but it is really hard to convince someone to use it. I tried to make my company switch to jabber as a mean of internal communication, started a server made them accounts but they never get into the habit to use it instead they preferred the non-free skype. People habits are so hard to change pfff.

    1. Marko Author

      In this capitalistic society people are educated that if you need something good you should avoid free stuff. Like jabber it self Prosody is really brilliant piece of software. From my experience the only way to to convert people to open source software is to force them to use open source technology for extended period of time to get used to it. Like with proprietary operating systems people will use Linux when proprietary OS manufacturers pull the plug on illegal software.

  2. jabber server

    Jabber is not a tool but a community which builds and maintains XMPP. XMPP stands for eXtensible Messaging and Presence Protocol. Such a protocol is open-standard and oriented to message exchange.

  3. Desmond

    I tried installing prosody using the commands listed, but when I add the second command (tee -a) as listed on the website, I keep getting “Invalid Option ‘O'” How do I rectify this?


Leave a Reply

Your email address will not be published. Required fields are marked *