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.listTo prevent warnings about unauthenticated packages, add Prosody’s key file using the command below.
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 updateThen, to install the Prosody package, simply run this command.
apt-get install prosodyThat’s it! Note that Prosody will be started after the installation. Stop it until we finish the configuration process.
service prosody stopProsody 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-serverYou will be asked to set the root user’s password. This password can be different for the Linux user.
Let’s install the MySQL client for managing the server.
apt-get install mysql-clientNow we can use it to log in to the server. After this command, you will be asked for the password you entered before!
mysql -u root -pWelcome to the MySQL console! Enter the following command 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.
exitNow that you know how to create MySQL databases, run nano to edit Prosody’s configuration.
nano /etc/prosody/prosody.cfg.luaScroll down. In 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 the configuration file again. Sorry if you closed it! We are going to set the administrator's 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 to apply the changes.
service prosody startWe can use the prosodyctl utility for creating accounts. It works like the Linux tool for adding users.
prosodyctl adduser yourname@yourdomain.comSet 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.