How To Install ejabberd on a CentOS 5 and CentOS 6 VPS

How To Install ejabberd on a CentOS 5 and CentOS 6 VPS

About ejabberd

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.

 

Installing ejabberd

First we need to enable EPEL-Repository (EPEL = Extra Packages for Enterprise Linux) on your VPS. This is OS dependent:

On a CentOS 5.x VPS

wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
sudo rpm -Uvh epel-release-5*.rpm

On a CentOS 6.x VPS

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
 

Set Hostname

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.

 

Start the Service

In order to make a new user, we first have to start the service.

sudo service ejabberd start
 

Make a User

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

Admin privileges

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
 

Web Interface

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.

 

Adding New Users from Web Interface

When you first load up the admin interface, it should look like the following:

admin interface

Click Virtual hosts -> example.com -> Users.

Here you will be able to add new users, as shown below:

add user

Just click the "Add user" button and it will be created!

 

Setting Up a Client

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.

    • Related Articles

    • Install SSL Certificate inside SolidCP

      Login to your SolidCP Control Panel 2. Click on Web Sites under your plan. 3.Click on the website to which you wish to install the SSL. 4. Choose SSL from the tabs on the next window. 5. If you already have the SSL click on Upload Certificate, ...
    • How To Set Up ProFTPD on CentOS 6

      How To Set Up ProFTPD on CentOS 6 Download the EPEL repository that will allow us to install proftpd daemon on our VPS. # rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm   Next, install proftpd  with yum # yum ...
    • How To Migrate from FirewallD to Iptables on CentOS 7

      Introduction Like most other Linux distributions, CentOS 7 uses the netfilter framework inside the Linux kernel in order to access packets that flow through the network stack. This provides the necessary interface to inspect and manipulate packets in ...
    • install mysqli on cPanel/WHM using EasyApache

      How to install mysqli on cPanel/WHM using EasyApache Overview: The MySQLi Extension is a relational database driver used in the PHP programming language to provide an interface with MySQL databases. To install mysqli using EachApache: 1. Login to WHM ...
    • How to install Composer in Linux

      To install Composer onto a Linux server run the following commands to, in order.   Download the installer to the current directory Verify the installer Run the installer Remove the installer 1)php -r "copy('https://getcomposer.org/installer', ...