Installing and running ejabberd on a AWS EC2 instance

This post describes the configuration of an ejabberd XMPP server running on an Amazon AWS EC2 instance as a first step to building a cluster later on.

  1. Launch an EC2 instance in the desired configuration. In order to stay within my Free Tier, I chose the smallest available configuration using EBS and running Amazon’s custom Linux image.
  2. Configure the security groups for the newly created instance. We need to allow SSH-access as well as open the ports used by XMPP/ejabberd. In default configuration, ejabberd is using TCP ports 5266, 5280 and 5269.
  3. Connect to your instance using SSH.
  4. To download and run the ejabberd installer enter the following commands. You can find the URL to the latest ejabberd release on their commercial website http://www.process-one.net. Make sure to check whether your instance is running a 64- or 32-bit OS and choose the corresponding installer.
  5. Choose the language you prefer and read and accept the license agreement.
  6. Confirm the default directory /opt/ejabberd-13.12 .
  7. As ejabberd server domain, enter the public DNS of your instance e.g. ec2-###-###-###-###.eu-west-1.compute.amazonaws.com.
  8. Select whether this instance will become a node of a cluster. As building a cluster will be covered in another blog post I will not go into detail here and select no for this step.
  9. Finish the setup.

Now we can start the server and check if it’s running using sudo /opt/ejabberd-13.12/bin/ejabberdctl start  and sudo /opt/ejabberd-13.12/bin/ejabberdctl status . This should give the following output:

Use  sudo /opt/ejabberd-13.12/bin/ejabberdctl register username host password  to create new users.

Users can connect to the server using any XMPP compliant client now. Please note that I only tried a few popular clients like Pidgin on Linux and Windows and iChat on OSX. As your server doesn’t have a valid certificate, the client will most probably show a warning and requests the user to confirm a security exception. I noticed that Thunderbird Chat will deny any connection to a ejabberd server running in a default configuration like this due to improper security configurations.

To shut down the server again, use sudo /opt/ejabberd-13.12/bin/ejabberdctl stop .