How to Install Ejabberd on Ubuntu Server

Ejabberd is a powerful XMPP server that enables instant messaging, chat, and real-time communication among connected devices. In this tutorial, we will guide you through the steps to install Ejabberd on Ubuntu Server.

Prerequisites

Before we begin, you need to ensure that you have the following prerequisites:

Step 1: Update the Server

Before installing Ejabberd, it is essential to update your server. This ensures that you have the latest updates, security fixes and patches on Ubuntu, which can make Ejabberd run more smoothly.

To update the server, open your terminal and enter the following command:

sudo apt-get update && sudo apt-get upgrade 

Step 2: Install Ejabberd

After updating the server packages, we can proceed to install Ejabberd. The installation process is straightforward, just follow the steps below:

sudo apt-get install ejabberd

During installation, you will be prompted to set your preferred database (Mnesia or MySQL) and several configuration parameters such as your hostname, cluster node name, and admin account details. You can use the default values for most of the configuration parameters unless you have unique requirements.

Once the installation is complete, you can start the Ejabberd service with the following command:

sudo systemctl start ejabberd

You can configure the Ejabberd service to start automatically every time you reboot your server with the following command:

sudo systemctl enable ejabberd 

Step 3: Configure Firewall for Ejabberd

At this point, Ejabberd is running correctly, but you need to configure your firewall to allow connections to the Ejabberd service. By default, Ejabberd uses the 5222 and 5269 TCP ports for client connections and inter-server communication.

To open these ports on your server's firewall, use the following command:

sudo ufw allow 5222/tcp
sudo ufw allow 5269/tcp

You can verify that the ports are open with the following command:

sudo ufw status

Step 4: Test Ejabberd Installation

Now that you have installed Ejabberd, you can test it by creating a user account and connecting to the service using an XMPP client such as Pidgin, Conversations, or Gajim.

You can create a new user account in the ejabberd Control Panel. The Control Panel is accessible from your web browser at:

http://<server-ip>:5280/admin/

Replace server-ip with your server's IP address. You will be prompted to enter the admin login details that you have set during the installation process.

After logging in, click on the "Virtual Hosts" tab and choose your hostname. Then, click on the "Users" tab to create a new user account.

Once you have created a new user account, open your XMPP client and connect to the Ejabberd server using the user credentials that you have just created.

If you can connect successfully, Ejabberd is now installed and working correctly.

Conclusion

In this tutorial, we have shown you how to install Ejabberd on Ubuntu Server. Ejabberd is a powerful and flexible XMPP server that enables instant messaging, chat, and real-time communication among connected devices. By following the simple steps outlined in this tutorial, you can install and configure Ejabberd quickly and easily.

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!