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 .

 

22 thoughts on “Installing and running ejabberd on a AWS EC2 instance

  • February 12, 2015 at 14:55
    Permalink

    This tutorial has been very helpful. Did u find the time to run ejabberd in an cluster on EC2. I am having some trouble in getting it to work

    Reply
    • April 5, 2015 at 00:38
      Permalink

      Dear Naveen,
      actually I did, I just did not find the time to write a post about it. Maybe I can help if you provide more detailed information about your problem.

      Reply
  • February 18, 2015 at 09:35
    Permalink

    Dear Sebastian,

    I followed the steps that you listed in this post. However I could not connect to the ejabberd server in my EC2 instance. It seems like the server name is incorrect. But I checked my setup. The name is correct. Can you please let me know what I could be doing wrong?

    Thanks,
    Di

    Reply
    • April 5, 2015 at 00:41
      Permalink

      Dear Di,
      sorry for my _very_ late reply, your comment got lost in the spam filter. If you did not figure out your problem on your own by now, I’d be glad to help. Please provide more detailed information about your setup.

      Reply
      • June 23, 2015 at 09:25
        Permalink

        Hi, I installed ejabberd on the server successfully and could access the web interface too. I didnt try it yet, but regarding the DNS name, what happens if I restart the instance. Obviously DNS changes and ejabberd doesnt connect anymore. Do you have a workaround?

        Reply
        • June 23, 2015 at 11:10
          Permalink

          What about AWS Elastic IP? This is just a demo configuration, so of course you would have to use a persistent IP in production.

          Reply
          • June 23, 2015 at 16:24
            Permalink

            Got it. Another question, after the installation, I couldnt find ejabberd.cfg file at all.I dont understand.

  • September 3, 2015 at 07:52
    Permalink

    Thanks for the post,

    I have successfully configured ejabberd in EC2 and the instance in running successfully

    But i am not able to connect to jabber account.I have registered two user but not able to connect (Have you ichat).

    Am i missing anything?

    Reply
    • September 4, 2015 at 09:48
      Permalink

      I’d recommend to use Pidgin for a first test. I never tried any other client. Please let me know if that works for you!

      Reply
  • September 25, 2015 at 09:01
    Permalink

    Hi Sebastian, great post.
    Please write how to set up cluster instance, I am working on it for some time and still can not do it. Did you user easy_cluster?

    Reply
    • September 25, 2015 at 09:51
      Permalink

      Hey Michał!
      Thank you for your comment! I will ask my colleague from back then if he can remember our configuration and try do to a brief write-up then.

      Reply
  • March 9, 2016 at 07:11
    Permalink

    Hey there Sebastian,

    I’m trying to install ejabberd on my EC2 and gave the domain with the EC2 public DNS name:
    ec2-##-##-##-###.ap-southeast-1.compute.amazonaws.com. I’m able to install it, but when I checked the status, it is showing me this:
    The node ejabberd@localhost is started with status: started
    ejabberd 16.02 is running in that node

    instead of:
    The node ejabberd@ec2-##-##-##-###.ap-southeast-1.compute.amazonaws.com is started with status: started
    ejabberd 16.02 is running in that node

    I also can’t open my admin webapp from http://ec2-##-##-##-###.ap-southeast-1.compute.amazonaws.com:5280

    But it seems that I can connect to the server using Pidgin client with pointing to ec2-##-##-##-###.ap-southeast-1.compute.amazonaws.com

    Do you mind telling me what went wrong?

    Reply
    • July 23, 2016 at 20:16
      Permalink

      I am also facing the same. Please let me know if you find out the reason

      Reply
  • May 14, 2016 at 22:30
    Permalink

    Hi Sebastian,

    Thanks for the post.
    I have successfully configured ejabberd in EC2 and the instance in running successfully

    But i am not able to register a new user with command sudo /opt/ejabberd-16.04/bin/ejabberdctl register soumya host mishra.

    It’s giving me error “Can’t register user soumya@host at node ejabberd@localhost: not_allowed”.

    Please help me to fix it.

    Thanks in advance.

    Reply
  • September 13, 2016 at 11:05
    Permalink

    facing the same issure

    Reply
  • Pingback: Issue with ejabberd's installation on Amazon AWS – Thông tin tiêu dùng

  • January 29, 2018 at 05:34
    Permalink

    I wish there was a “buy the author a beer” button. Sebastian – if I can do anything for you…

    Reply
  • July 16, 2018 at 06:17
    Permalink

    I followed the steps .Able to start the server .But the URL is not coming up.
    ec2-xx-xx-xxx-xx.us-west-1.compute.amazonaws.com refused to connect.
    I opened the ports in the security group.TIA

    Reply
  • September 14, 2018 at 22:03
    Permalink

    I had to open TCP Port 5222 in the Security Group as well. Then it started working.

    Reply

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.