This article covers a version of CentOS that is no longer supported. If you are currently operating a server running CentOS 6, we highly recommend upgrading or migrating to a supported version of CentOS.
Reason: CentOS 6 reached end of life (EOL) on November 30th, 2020 and no longer receives security patches or updates. For this reason, this guide is no longer maintained.
See Instead: This guide might still be useful as a reference, but may not work on other CentOS releases. If available, we strongly recommend using a guide written for the version of CentOS you are using.
Ejabberd is a very simple, stable, and powerful XMPP server written in Erlang. This tutorial will guide you through the installation process and basic setup on a CentOS VPS.
First we need to enable EPEL-Repository (EPEL = Extra Packages for Enterprise Linux) on your VPS. This is OS dependent:
wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
sudo rpm -Uvh epel-release-5*.rpm
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -Uvh epel-release-6*.rpm
For more information on EPEL, click here.
After enabling EPEL, we are ready to install ejabberd from the repositories. Do the following as root.
sudo yum install ejabberd
The host name of your ejabberd service is set in the ejabberd config. Edit this with your preferred editor of your choice. In this example, I will be using vim.
sudo vim /etc/ejabberd/ejabberd.cfg
Find the hostname section (Line #91. It should look something like:
%%%. ================
%%%' SERVED HOSTNAMES
%% hosts: Domains served by ejabberd.
%% You can define one or several, for example:
%% {hosts, ["example.net", "example.com", "example.org"]}.
%%
{hosts, ["localhost"]}.
We want to add a new hostname. This is done by editing the last line in the snippet. If we would like to add example.com
, it would look like this:
{hosts, ["localhost","example.com"]}.
Now that we have added your domain, save the file.
In order to make a new user, we first have to start the service.
sudo service ejabberd start
To add a new user, run the following command:
ejabberdctl register username host password
Replace username, host and password with your own data. For example:
ejabberdctl register admin example.com superman
Now have a user called admin
with the password superman
, we would like to give this user admin privileges.
We do this by editing the ejabberd configuration file like before. Find the admin user section (Line #369) in the config, which should look something like this:
%%%. ====================
%%%' ACCESS CONTROL LISTS
%%
%% The 'admin' ACL grants administrative privileges to XMPP accounts.
%% You can put here as many accounts as you want.
%%
%%{acl, admin, {user, "aleksey", "localhost"}}.
%%{acl, admin, {user, "ermine", "example.org"}}.
Now, add the following line. This will give our user admin rights.
{acl, admin, {user, "admin", "example.com"}}.
Remember to restart the ejabberd service every time we change something in the configuration file:
sudo service ejabberd restart
Ejabberd ships with a very nice and simple web-interface for statistics, configuration, etc.
You should spend some time browsing the web-interface to get familiar with it, it’s quite simple and shouldn’t take too long.
To open the web-interface, start a browser and go to:
http://example.com:5280/admin
You will need to authenticate with an admin user.
When you first load up the admin interface, it should look like the following:
Click Virtual hosts -> example.com -> Users.
Here you will be able to add new users, as shown below:
Just click the “Add user” button and it will be created!
In this section, I will be using Gajim. While there are many clients, the steps will be similar to the following with Gajim.
First, download Gajim, install it, and start the client.
We now have to add the newly created user. To do this, go to Edit->Accounts
.
Click on the “Add” button, choose “I already have an account i want to use”, and press “Forward”.
Now enter the account information.
Tick the “Connect when I press Finish” box and click “Finish”. You have now connected to your own XMPP server.
<div class=“author”>Article Submitted by: Denhart</a></div>
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi,
It seems to be a nice tutorial but I was stuck on the 3 line . What I observerd is when I tried to run “sudo rpm -Uvh epel-release-6*.rpm” it gave me epel is already installed so I continued . when I tried to “sudo yum install ejabberd” it gave me following error :
“epel is listed more then one in the configuration rightscale-epel nothing to do”
How could I remove this error. I tried uninstalling and installing epel but it was of no use. Please reply asap.
This no longer works, as ejabberd was removed from EPEL.
Hi I installed ejabberd server on CentOS 6, but I cannot login to it from internet.
Here is my log:
Leave a comment… i had cobfigured ejabberd on my centos server successfully & pidgin as messenger for my ubuntu & windows client, but the problem is i have to add each buddies manually by typing there names, is there any option by which i get list of buddies who are using my ejabberd server for messaging by pidgin.
This tutorial is great! Any clue how to add this module after installing using this tutorial? https://github.com/jadahl/mod_restful
I can´t get it compile. thx
@jaime.f.pinto: Is ejabberd running? <pre>sudo service ejabberd status</pre>
Hi, thanks for the tutorial, but I am not getting the Web interface. Can ou help me on this ? Thanks in advance. Jaime
This is the best instructions I have found for installing ejabberd. Everything worked like a charm :-) Thanks, Denhart
@rajeev0507: See if this helps: <a href=“http://www.ejabberd.im/Using ejabberd with MySQL native driver”>http://www.ejabberd.im/Using ejabberd with MySQL native driver</a>
Can anyone extend this article and explain the working of mysql database with ejabberd