How to Install Prosody IM on FreeBSD

Prosody is a modern XMPP communication server. It is easy to set up and it is free and open source. In this tutorial, we will guide you through the installation process of Prosody on FreeBSD.

Prerequisites

Step 1: Update your FreeBSD Packages

Use the below command to update FreeBSD packages:

sudo pkg update && sudo pkg upgrade

Step 2: Install Prosody IM

We can install Prosody with the package manager using the below command.

sudo pkg install prosody

Step 3: Configure Prosody IM

Prosody default configuration available in /usr/local/etc/prosody/prosody.cfg.lua. When starting for the first time, Prosody will generate an empty configuration file in /usr/local/etc/prosody/.

sudo cp /usr/local/etc/prosody/prosody.cfg.lua /usr/local/etc/prosody/prosody.cfg.lua.orig

Open the configuration file with your preferred text editor.

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

Edit the following lines to reflect your server’s name and IP address.

admins = { "[email protected]" }

modules_enabled = {
    "roster"; -- Allow users to have a roster. Recommended ;)
    "saslauth"; -- Authentication for clients and servers. Recommended if you want to log in.
    "tls"; -- Add support for secure TLS on c2s/s2s connections
    "legacyauth"; -- Legacy authentication. Only used by some old clients and bots.
}

VirtualHost "[your.domain.tld]"
    enabled = true
    ssl = {
        key = "/usr/local/etc/prosody/certs/your.domain.tld.key";
        certificate = "/usr/local/etc/prosody/certs/your.domain.tld.crt";
    }

Save and close the file once changed.

Step 4: Enable and Start Prosody IM

Use the below command to enable and start the Prosody service.

sudo sysrc prosody_enable=YES
sudo service prosody start

Step 5: Allow Firewall rules for PROSODY IM

Prosody uses the following ports by default.

Use the below command to allow these ports through your firewall.

sudo firewall-cmd --permanent --add-port=5222/tcp
sudo firewall-cmd --permanent --add-port=5269/tcp
sudo firewall-cmd --permanent --add-port=5280/tcp
sudo firewall-cmd --permanent --add-port=5281/tcp
sudo firewall-cmd --reload

Conclusion

You have learned how to install Prosody IM on FreeBSD with basic configuration. You can now create new users and configure Prosody to your preferences.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!