eJabberd XMPP

How To Install eJabberd XMPP Server on Ubuntu 24.04 or Newer

Welcome back to the Greenhost.cloud blog! Today, we’re diving into the world of XMPP (Extensible Messaging and Presence Protocol) by exploring how to install the eJabberd XMPP server on Ubuntu 24.04 or newer. eJabberd is a robust and scalable messaging server that supports a variety of features such as group chats, file transfers, and more.

Whether you’re looking to set up a private chat server for your organization or to create a platform for your community, eJabberd is a fantastic choice. Let’s get started!

Prerequisites

Before we begin, make sure you have the following:

  1. Ubuntu 24.04 or newer installed on your server.
  2. Root or sudo privileges on your machine.
  3. A domain name or a subdomain pointing to your server’s IP address (e.g., chat.yourdomain.com).
  4. Basic knowledge of command line operations.

Step 1: Update Your System

First, we need to ensure that your system is up to date. Open your terminal and run the following commands:

sudo apt update
sudo apt upgrade -y

This will fetch the latest package lists and install any available upgrades.

Step 2: Install Dependencies

eJabberd requires several dependencies to run smoothly. Install them by executing:

sudo apt install -y build-essential libssl-dev libexpat1-dev libyaml-dev

Step 3: Install eJabberd

Now, let’s install eJabberd. The easiest way to do this on Ubuntu is to use the official package manager.

  1. Add the eJabberd repository:
echo "deb http://packages.ejabberd.im/ubuntu/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ejabberd.list
  1. Add the GPG key for the repository:
wget -qO - https://packages.ejabberd.im/ubuntu/ejabberd.gpg.key | sudo apt-key add -
  1. Update the package list again:
sudo apt update
  1. Install eJabberd:
sudo apt install -y ejabberd

Step 4: Configure eJabberd

After installation, we need to configure eJabberd to work with your domain.

  1. Edit the eJabberd configuration file:
sudo nano /etc/ejabberd/ejabberd.yml
  1. Set your domain name:

Find the hosts section and update it with your domain:

hosts:
  - "chat.yourdomain.com"
  1. Configure the admin user:

Locate the acl section and add your admin user:

acl:
  admin:
    user:
      - "[email protected]"
  1. Create the admin user:

After saving the configuration file, create the admin user with the following command:

sudo ejabberdctl register admin chat.yourdomain.com password

Make sure to replace password with a strong password.

Step 5: Start eJabberd

Now that everything is configured, it’s time to start the eJabberd server:

sudo systemctl start ejabberd

To ensure that it starts on boot, enable it with:

sudo systemctl enable ejabberd

Step 6: Access the Web Admin Interface

eJabberd comes with a web-based admin interface, which allows you to manage your server easily.

  1. Open your web browser and navigate to:
http://chat.yourdomain.com:5280/admin
  1. Log in using the admin credentials you just created ([email protected] and the password you set).

Step 7: Configure SSL (Optional but Recommended)

For secure communications, it’s essential to set up SSL. You can use Let’s Encrypt to obtain a free SSL certificate. Install Certbot if you haven’t already:

sudo apt install certbot

Then, run Certbot to get your SSL certificate:

sudo certbot certonly --standalone -d chat.yourdomain.com

After obtaining the certificate, update the eJabberd configuration file to use it:

certfile: "/etc/letsencrypt/live/chat.yourdomain.com/fullchain.pem"
keyfile: "/etc/letsencrypt/live/chat.yourdomain.com/privkey.pem"

Don’t forget to restart eJabberd after making these changes:

sudo systemctl restart ejabberd

Conclusion

Congratulations! You have successfully installed and configured the eJabberd XMPP server on your Ubuntu 24.04 (or newer) machine. With eJabberd’s extensive features and flexibility, you’re well on your way to creating a powerful messaging platform.


Stay tuned for more tutorials and guides from Greenhost.cloud. Make sure to follow us on our social media channels for the latest updates in cloud hosting and technology!