Last updated on July 31st, 2016 at 11:11 am

In this post i am going to explain how to setup Ejabberd server on your ubuntu ec2 instance.

Setup Ejabberd server on EC2 ubuntu instance

About ejabberd ?

The ejabberd instant messaging server is software to communicate and collaborate in real-time between two or more people based on typed text.

Official sitehttps://www.ejabberd.im/

Here are some simple step which you follow to setup your own chat server.

Step 1. I hope you already setup your Ubuntu ec2 instance.

Step 2. Login to your instance using putty. If you are login to Ubuntu instance using putty your username/host must be:

[email protected]

Step 3. Once you logged in successfully run this command in putty shell

apt-get -y install ejabberd

*Note you need to login to root account of your instance otherwise you get permission error, to login to root account enter this command

sudo su

Step 4. Now once jabber is installed successfully you need to edit its config file to change setting enter bellow command to edit its config file

nano /etc/ejabberd/ejabberd.cfg

after enter above command editor open. now pres ctrl+w and enter Admin user it simply match the keyword you enter and take you to that location

Setup Ejabberd server on EC2 ubuntu instance

now by default Ejabberd set localhost as default host we need to change two thing as shown below replace old one with your once.

Setup Ejabberd server on EC2 ubuntu instance

%% Admin user
{acl, admin, {user, "admin", "ec2-xxxxxxxxx.us-west-2.compute.amazonaws.com"}}.

%% Hostname
{hosts, ["ec2-xxxxxxxxx.us-west-2.compute.amazonaws.com"]}.

Step 5. After making change in config file we need to restart or sever, to restart enter below command in shell

service ejabberd restart

Step 6. After this we can set new password to server by typing following command.

ejabberdctl register admin ec2-xxxxxxxxx.us-west-2.compute.amazonaws.com mypassword

Step 7. This is last step you need to add port number to  on your instance Securty group so that server can run. Login to your aws console. Inside you ec2 instance look for NETWORK & SECURITY ⇒ Security Groups now click on action and look for Edit Inbound rule and add new rule and define your port number as shown in below image.

Setup Ejabberd server on EC2 ubuntu instance

Step 8. Now in your browser enter url

http://ec2-xxxxxxxxx.us-west-2.compute.amazonaws.com:5280/admin

and login to your server

Setup Ejabberd server on EC2 ubuntu instance

All done 🙂