Instant Messaging with Prosody on Debian Squeeze

prosody

Hello friends!. Today I present to you a modern and flexible server Jabber / XMPP, written in the language Moon and formerly known as Lxmppd. It has the characteristics of being a multiple platform system, with very low resource consumption, easy to use, and extensible. And without further ado, let's get down to business! They may seem like many aspects, but they really are simple and short. We'll see now:

  • Base server
  • We install necessary packages
  • Let's learn to configure
  • We configure global parameters
  • We create and configure the virtual host
  • We generate SSL / TLS certificates
  • We enable the host
  • We create the first user
  • We register our Prosody in a DNS
  • We check everything

Base server
The low consumption of resources allows us to install the Prosody even in our own workstation and provide the Chat service from it.

We install necessary packages
To get familiar with the Prosody, we are going to use the official packages that come in the Squeeze repository:

aptitude install prosody liblue5.1-sec0

Let's learn to configure
Let's read the accompanying documentation /usr/share/doc/prosody/doc/coding_style.txt, to familiarize ourselves with the format used in the configuration files. Let's go to the folder / etc / prosody and we list the existing files and directories. The names of each folder or file are intuitive and clearly denote what they are used for:

  • certs: Directory where the SSL / TLS certificates and their private keys will be stored.
  • conf.avail: Directory that contains the configuration files of the virtual hosts that we declare as available. It works very similar to what was seen in previous posts about web servers, as in the case of the Nginx sites-available folder.
  • conf.d: Folder where the direct links of virtual hosts declared in conf.avil and that we want to enable.
  • prosody.cfg.lua: main file of the Prosody configuration.
  • README: File that gives us a "clue" to move forward. Don't stop reading it!

With what we have read so far, we can try a minimal initial configuration.

We configure the Global parameters
We carefully study the main configuration file/etc/prosody/prosody.cfg.lua, to which I made a free translation and that we can download at the end. Let's save the original file installed using the following command:

cp /etc/prosody/prosody.cfg.lua /etc/prosody/prosody.cfg.lua.original

We empty the configuration file. With the dwarf, we edit the prosody.cfg.lua already emptied, and paste the content of the downloaded example file. We modify it according to our needs, and save with the usual ctl + or. Later we check the syntax of the configuration file:

cp / dev / null /etc/prosody/prosody.cfg.lua nano /etc/prosody/prosody.cfg.lua luac -p /etc/prosdy/prosody.cfg.lua

And if you do not return any message, it is that everything is fine.

We create and configure the Virtual Host
The file of our virtual host, we will create it in the directory /etc/prosody/conf.avail/with the hostname, plus the extension .conf.lua, and we will create it from the fileexample.com.cfg.lua existing in that folder:

mv /etc/prosody/conf.avail/example.com.cfg.lua /etc/prosody/conf.avail/web.amigos.cu.cfg.lua nano /etc/prosody/conf.avail/web.amigos.cu .cfg.lua

We modify the file with the correct parameters according to our needs. We can download a version consistent with this example at the end of the post. Don't forget to delete the line enabled = false - Remove this line to enable this host.

We generate SSL / TLS certificates
When executing the command to generate the certificates, they will ask us for information related to our company.

cd / etc / prosody / certs openssl req -new -x509 -days 365 -nodes -out "web.amigos.cu.crt" -keyout "web.amigos.cu.key"

We check that the certificates were generated correctly by Ls -l.

We enable the host
To enable the host declared in /etc/prosody/conf.avail/web.amigos.cu.cfg.lua, we must create a symbolic link of that file in the folder conf.d. Then we must restart the service:

ln -s /etc/prosody/conf.avail/web.amigos.cu.cfg.lua /etc/prosody/conf.d/web.amigos.cu.cfg.lua /etc/init.d/prosody restart

Tip:: Open a dedicated console to view Prosody log messages using the command tail -f /var/log/prosody/prosody.log. If the last line says "Successfully daemonized to PID ####", then everything works to the Kilo !. If you happen to get an error message, you may have to manually kill the process "Lua" that it is running BEFORE restarting the Prosody. To know the Pid del Lua, runps -e | grep lua. To kill the process, kill -kill #pid of lua.

We create the first user
To create users we use the command prosodyctl as follows:

prosodyctl adduser admin@web.amigos.cu

The command will ask us for the "Password" user. Notice we create the user "Admin", which we declare as Prosody Administrator in the global configuration file prosody.cfg.lua.

WE RECOMMEND DO NOT use the command prosodyctl to stop, start, or restart the service, but do it by traditional methods such as:

/etc/init.d/prosody {start | stop | restart | reload} invoke-rc.d prosody {start | stop | restart | reload} service prosody {start | stop | restart | reload}

We register our Prosody in a DNS
The instant messaging service relies heavily on the DNS service. Each user is identified by his address or IADB in the way of user @ domain, where the domain indicates the server on which the account is stored. In order for the user to connect and log in, it is necessary to find the IP address of the server. Similarly remote servers need to contact the user @ domain to pass you a message. Therefore, it is necessary that the Prosody server has a record type A in the DNS server of our LAN. For example:

192.168.10.20 IN To web.amigos.cu.

We check everything
We already have our Prosody server running. Let's chat then! Install Pidgin or Psi, or choose the XMPP client of your choice and connect to the server. If he succeeds, it is because then he followed the content of this article to the letter. If not, ask, that's what blogs like this were made for. Ahhh, if you want to chat from a console, install the Finch.

We made a package with the documentation from the Prosody official site, which we hope will be useful. Those who wish to download the packages directly from the Prosody repository, visit Prosody package repository.

To all, good luck and happy Chat!

Download sample files

Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   eliotime3000 said

    Good suggestion. Let's see if I take the time to make an instant messaging client.

    1.    elav said

      Another XMPP client? Man, I don't think it's necessary unless you do it to learn and set it as your goal. They are already Pidgin, Kopete, KDE-Telephaty, Empathy, PSI ... anyway.

      1.    dhunter said

        Well, as much as another client I don't think so but it would be fun to play with the XMPP API and send messages from applications.

      2.    rots87 said

        It would be fine if for example you need to make a kind of chat for an internal network or something similar

      3.    braybaut said

        If that is true, but this tutorial is used to implement an XMPP client in Free networks

        1.    dhunter said

          This tutorial is for the server, there are already a few free clients.

      4.    eliotime3000 said

        For Windows, it would serve a lot (in the absence of the mythical Messenger, it would be good to make a better one, right?).

  2.   Federico A. Valdes Toujague said

    Thank you all for your comments. My dream is to have a web client to chat on my LAN. I installed ejabberd with JwChat and since the interface in Squeeze was sticky (and ugly and buggy), I didn't even try it. I tried the Yaws web server and its Yaws-chat web client and couldn't get it up and running properly. They downloaded the PHPFreeChat and nothing. With Lenny's Drupal 6 I tried to configure the plugins for the chat and I got tired back then, several years ago. I dream of not depending on the installation of clients and chatting with a browser nothing more. The Challenge is launched.

    1.    eliotime3000 said

      You're welcome, buddy. Let's see if I can finish downloading the Wheezy DVD1 to do a tutorial on how to install ZPanelX in the new version of Debian Stable (I hope that the ZPanel developers do not abandon the Ubuntu 12.04 LTS support, because otherwise I could not do a automated installation of that control panel which I found great when I tested it on Windows).

  3.   New to Debian said

    Hello, if I installed Debian 7 a little while ago. However I don't have internet, it tells me that I am missing the firmware. It is a usb tp link tl-wn321g. Can I download it from Windows? Sorry to ask here is that I do not want to register in any debian forum, also I do not know English very well.

    1.    eliotime3000 said

      If the TP-Link has the Altheros chipset, it should recognize it without complications.

      Find out if your TP-Link USB model has the Altheros chipset, as well as write down the Hardware ID.

    2.    commentator said

      If you want to download the iso here, they are debian isos but they come with non-free drivers and firmware.

      http://live.debian.net/cdimage/release/7.0.0+nonfree/i386/iso-hybrid/

  4.   rots87 said

    I would like a good tuto on asterisk hehehe

    1.    Julius Caesar said

      I recommend that you start by using Trixbox CE or Elastix both are based on Asterisk

      http://www.elastix.org/

      http://www.trixbox.com/

  5.   msx said

    Very good guide, thank you very much 🙂

  6.   alejandrodez said

    Excellent, thank you very much it has been very useful.

  7.   @Jlcmux said

    I will test it in the Mesh Free Network that we are implementing in my city. Then I'll tell you how I'm doing with this.

    Regards.!

  8.   @Jlcmux said

    What a pity. I stayed in the last step. Where do I configure the DNS? What a shame to be the only one who asks this haha

  9.   Piccolo Lenz McKay said

    I have some very interesting questions:

    Have you known or is there experience for an installation in production of prosody for 3000 users where there are concurrently connected at least 1000 chatting at the same time?

    Support for: file transfer, VIP, and is this the most important conversation log?

    ENVIRONMENT: 3 thousand users, with disabled web reg and scripts via server invoked through cgi prawns for user registration and manipulation, in an 8-core DELL T110 with 8Gb of ram for exclusive use or for ejabberd in lenny with ported erland and ejabberd

    The ball swells, after accommodating a lot of problems in the ejabberd, I find this, actually this makes me feel like I wasted my time ..

    1.    Federico A. Valdes Toujague said

      My regards PICCORO Lenz McKAY !!!. Look, I recommend you visit the official website of Prosody http://prosody.im, and expand the information. I have no experience over 1000 clients chatting at the same time with the Prosody. And I don't think you wasted your time with the Ejabberd. It's a decision you made in Lenny's time. By the way, I confess that Ejabberd was the first one I installed on my business lan, where maybe 50 or 60 users chatted in unison. The server didn't even know it, and that it had only 512 megabytes of RAM. 🙂 And yep, I had a hard time setting it up properly. The Prosody is very simple, but I invite you to find out more about its potentialities. It's not that I doubt him, but that I don't have the experience that you need.