How To: Install and Configure ejabberd on Ubuntu Server
ejabberd is XMPP server software which can be used for instant messaging on your own server. In this tutorial, you will be able to learn how to properly install and configure ejabberd on Ubuntu Server.
With that, let’s get started.
Step 1: Download & Install
ejabberd is available in the Ubuntu repositories, so it’s easy to download and install.
Simply run:
sudo apt-get install ejabberd
Step 2: Configure
Open up the ejabberd configuration file by running:
sudo nano /etc/ejabberd/ejabberd.cfg
*If you prefer an editor other than nano, you can obviously substitute that for the file above.
In the config file, locate the following:
%% Hostname {hosts, ["localhost"]}.
Modify this line to represent the correct host name. Example:
%% Hostname {hosts, ["localhost","example.net"]}.
Directly above you”ll find the following:
XMPP: The Definitive Guide: Building Real-Time Applications with Jabber Technologies
%% Admin user {acl, admin, {user, “”, “localhost”}}.
Between the quotes, type whatever you want your admin username to be, and then change “localhost” to your hostname.
Once that’s done, save the file and reboot the ejabberd daemon:
sudo /etc/init.d/ejabberd restart
Practical Guide to Linux Commands, Editors, and Shell Programming, A (2nd Edition)
Next, create the admin account. To do this, run:
sudo ejabberdctl register admin localhost password
Substituting “admin” for the username you created earlier, “localhost” for your correct server hostname, and “password” for whatever you want your password to be.
If all went well, you can now access the web interface for ejabberd by browsing over to http://yourhostname:5280/admin. Type in your username and password when prompted. You should see the following:
Step 3: Connect to the ejabberd Server
It should now be possible to connect to your ejabberd server from an IM client that supports XMPP. We”ll try connecting using Empathy, the current default messaging client in the desktop version of Ubuntu.
Select Jabber as the account type, and then type in the username you created earlier along with the hostname (example: username@hostname). Finally, enter the password for the account.
Additional Accounts You might want to create some more accounts for your friends or other computers in your network on the server. The best way to do this is by running ejabberdctl for each individual account you want to create.
sudo ejabberdctl register newuser localhost password
It’s also possible to add additional users through the web interface. Additional Admin AccountsTo create an additional admin account, open the ejabberd.cfg file and locate:
%% Admin user {acl, admin, {user, “”, “localhost”}}.
Create a new line under this and add:
{acl, admin, {user, “”, “localhost”}}
Add your new username between the quotes and provide your hostname, replacing “localhost”. Finally, run ejabberdctl as shown in Step 2 for creating the admin account.
This tutorial was last updated on July 31st, 2013.