Prosody is a XMPP communication server written in LUA. It aims to be easy to set up and configure, and efficient with system resources. Prosody is open-source software!
In this tutorial, we are going to install Prosody on a Debian 7.0 server. It’s recommended to make a fresh install of the operating system before installing Prosody.
Let’s start adding Prosody’s repository to our server.
echo deb http://packages.prosody.im/debian wheezy main | tee -a /etc/apt/sources.list
In order to prevent warnings about unauthenticated packages, add Prosody’s key file using the below command.
wget http://prosody.im/files/prosody-debian-packages.key -O- | apt-key add -
Now we can update APT to find the new repository.
apt-get update
Then to install the Prosody package simply run this command.
apt-get install prosody
That’s it! Note that Prosody will be started after the installation. Stop it until we finish the configuration process.
service prosody stop
Prosody also works with MySQL, and that’s awesome! But it also works without it, skip this step if you don’t want to enable MySQL.
We can start by installing the MySQL server.
apt-get install mysql-server
You will be asked for set root
’s user password. This password can be different to the Linux user.
Let’s install the MySQL client for managing the server.
apt-get install mysql-client
Now we can use it to log in into the server. After this command you will be asked for the password entered before!
mysql -u root -p
Welcome to the MySQL console! Enter the following command in order to create the Prosody database.
CREATE DATABASE prosody;
The following command creates the MySQL user.
CREATE USER prosody@localhost;
It’s highly recommended to add a password. Security reasons, you may know.
SET PASSWORD FOR prosody@localhost= PASSWORD(‘mypassword’);
Now we’ll give permissions to the new user.
GRANT ALL PRIVILEGES ON prosody.* TO prosody@localhost IDENTIFIED BY ‘mypassword’;
Run the last command before exiting.
FLUSH PRIVILEGES;
And now you can exit writing this.
exit
Now that you know how to create MySQL databases, run nano
to edit Prosody’s configuration.
nano /etc/prosody/prosody.cfg.lua
Scroll down. At the middle of the file you will find the MySQL configuration lines. Uncomment it and add the requested information, it should look like this.
storage = sql” — Default is internal”
sql = { driver = MySQL”, database = prosody”, username = prosody”, password = mypassword”, host = localhost” }
Remember to leave the other SQL lines commented and you’re done.
Our server should be running on a hostname like xmpp.yourdomain.com
, but we want to create users using our domain, like someuser@yourdomain.com
. We are going to configure Prosody to work with it!
Open configuration file again, sorry if you closed it! We are going to set the administrator XMPP address.
admins = { yourname@yourdomain.com” }
Scroll down to find the virtual hosts section and add one for your domain. It should look like this.
VirtualHost yourdomain.com”
Now you can close the configuration file! I will not order you to open it again, I promise. You have to start your Prosody server in order for applying the changes.
service prosody start
We can use the prosodyctl
utility for creating accounts. It works like the Linux tool for adding users.
prosodyctl adduser yourname@yourdomain.com
Set the password and you’re done. Enjoy your new and stunning XMPP server! Remember to look into Prosody’s website for plugins and even more awesome content for customizing your server.