HOW TO SETUP AND CONFIGURE EJABBERD ON UBUNTU 16.04 EC2 AWS ?

  • October 16, 2023

    HOW TO SETUP AND CONFIGURE EJABBERD ON UBUNTU 16.04 EC2 AWS ?

    1. Setup EC2 instance

    2. Login to your EC2 instance with Terminal or Putty .

    3. Install Ejabberd

    sudo apt-get -y install ejabberd

    Note- If you get any error like “package not found” then run sudo apt-get update and try the above command again.

    4. Edit Config File to setup admin user and host

    sudo vi /etc/ejabberd/ejabberd.yml

    Make below changes in the config file

    Note — Be very careful while editing the ‘yml’ file as it has indent based syntax.

    hosts:

    – “localhost”

    acl:

    ##

    ## The ‘admin’ ACL grants administrative privileges to XMPP accounts.

    ## You can put here as many accounts as you want.

    ##

    admin:

    user:

    • “admin”: “localhost”

    4. Restart Ejabberd

    sudo service ejabberd restart

    5. Now register your admin user

    sudo ejabberdctl register <username> <host> <password>

    E.g

    sudo ejabberdctl register admin 162.222.226.38 eja123

    Where you will register admin user from command prompt then you will get below error:

    /usr/sbin/ejabberdctl: line 428: 3427 segmentation fault

    To solve the error, I opened the apparmor configuration file:

    nano /etc/apparmor.d/usr.sbin.ejabberdctl

    Found the string:

    /bin/su r,

    And changed it by adding m:

    /bin/su rm,

    Restarted apparmor:

    sudo service apparmor restart

    6. Make sure you have opened ports 5222 and 5280 on AWS for your EC2 instance from its security group.

    7. Login to Admin Console Panel

    1. Visit https://<your-ip-address>:5280/admin/ in your browser

    2. Username — <username>@<host> E.g admin@localhost

    3. Password — <password you set while registering>

    That’s it, If you see console panel you have completed your setup.

     

    Extra Points –

    1. If you mess up your installation or if you mess up while editing your config file and you are not able to revert your changes. Then simply remove Ejabberd and try again from step 1.

    To remove Ejabberd run following commands

    sudo apt-get purge ejabberd

    sudo apt-get autoremove

    2. Other useful commands

    sudo service ejabberd <start/stop/status>

    OR

    sudo ejabberdctl <start/stop/status>

    3. To check Ejabberd Version

    sudo ejabberdctl status

    Anonymous Login Support (as well as authenticated login)-

    sudo vi /etc/ejabberd/ejabberd.yml

    Make below changes in the config file

    auth_method: internal

    host_config:

    “localhost”:

    auth_method:

    – internal

    – anonymous

    anonymous_protocol: sasl_anon

    allow_multiple_connections: false

    To Enable History –

    mod_mam:

    default: always

    Comments

WhatsApp