Skip to main content

I'm writing these steps primarily for myself as a reference.  However, if someone else finds them useful to great.

Adding XMPP framework to your server.  Initially I was going to add Prosody, however as I'm working off an Apache server with Centos 6.10 this quickly proved to a goal that was out of reach.  Instead, I pivoted and redirected to Erlang.  

  1. Is your server hardware running Linux, BSD, OS X, or Windows?
  2. Can you use Java or Python or another language if the server software requires it?
  3. Do you need to make this server scalable? 
  4. Is it for private use, or public use?
Adding to the server

Begin by downloading erlang from Erlang-Solutions downloads... for more details see our notes on installing erlang.

Using terminal first make a copy of the rpm file from the Process-One site

wget https://www.process-one.net/downloads/ejabberd/18.09/ejabberd-18.09-0.x86_64.rpm

wget https://www.process-one.net/downloads/downloads-action.php?file=/ejabberd/19.02/ejabberd-19.02-0.x86_64.rpm

...or preferably use Github resource

https://github.com/processone/ejabberd.git

I installed the rpm package in the root directory on the apache server.

Then installed the RPM package

rpm -Uvh ejabberd-19.02-0.x86_64.rpm

Check if the package has been installed

yum info ejabberd

Install Erlang

yum install erlang

Check that Erlang has been installed

erl

If the Erlang package has been successfully installed terminal will be output something like

Erlang/OTP 21 [erts-10.1] [source] [64-bit] [smp:48:8] [ds:48:8:10] [async-threads:1] [hipe] 

 

The next step involves setting up ejabberd on the directory for the domain name that you are planning to use.  Such as /var/www/vhosts/example.com

git clone git://github.com/processone/ejabberd.git ejabberd

cd ejabberd

./autogen.sh

To compile ejabberd execute the commands

./configure
./configure --enable-user=ejabberd --enable-mysql

It isn't recommended to run ejabberd with root user.  So tell the configuration to prepare the installed program to run with a user called ejabberd.

make
make install

When these scripts were run, the make request failed.  The steps I needed to attend to were 

error configure: error: OpenSSL 'ssl' library was not found
script

sudo yum install libtool perl-core zlib-devel -y

yum install openssl-devel 

I ran the sudo yum install libtool perl-core zlib-devel -y to ensure that there would be no issues with the OpenSSL installation.  A great reference site is Black Sail Division page about installing OpenSSL on Centos 7.Also note the OpenSSL was installed on the server and you can check this through running this script

openssl version

By default the version shown will most likely be OpenSSL 1.0.1e-fips 11 Feb 2013

error configure: error: libexpat header file expat.h was not found
script

yum install expat-devel

 

error configure: error: libyaml header file yaml.h was not found
script

yum install libyaml-devel

By default the version shown will most likely be OpenSSL 1.0.1e-fips 11 Feb 2013

error /usr/lib64/erlang/bin/escript rebar skip_deps=true compile
WARN:  Missing plugins: [rebar3_hex]
script

$ git clone https://github.com/erlang/rebar3.git
$ cd rebar3
$ ./bootstrap

Post adding the script for the libyaml error... I was able to run the make command without issue.

make
make install

Yay.  Okay so now onto the next step, starting ejabberdctl

ejabberdctl start

You need to have started ejabberd before registering, otherwise the ejabberdctl command will not be found.  Creating a new user, you need to follow this format

ejabberdctl register <username> <hostname> <password>

However, when I ran the register command I received the Error: cannot_register and this was due to the domain name not being found.  I tried multi Google and DuckDuckGo searches that consistently pointed to vi /opt/ejabbered*/conf/ejabberd.yml.  I edited this files without success.  How did I know it wasn't working, easy as it was a method confirmed by entering the following command

ejabberdctl registered_vhosts

Which outputted the following domains

localhost
example.com

So how did I find the correct file to edit?  In terminal I cd / and ran a search for ejabberd on the server.  The find command is

find / -name ejabberd -type d

​This command showed the following results:

/usr/local/share/doc/ejabberd

/usr/local/etc/ejabberd

/usr/local/var/log/ejabberd

/usr/local/var/lib/ejabberd

The file path to be edited was /usr/local/etc/ejabberd.  The file ejabberd.yml.  Once this was altered, I stopped and restarted ejabberd.  Now registered_vhosts was finally showing the correct domain names!

Related articles

Andrew Fletcher06 Jun 2021
composer memory_limit
A recent attempt to run an update&nbsp;composer (regular activity for many of us), I had a memory limit issue. &nbsp;This was surprising because&nbsp;the memory setting via Plesk is set to 2G. &nbsp;Yet through Terminal&nbsp;it was showing only 128MB. &nbsp;What gives?? &nbsp; The error I was...
Andrew Fletcher07 Feb 2021
PHP version on Apache Centos 7
I need to set the default php-version of a subscription to php7.3. &nbsp;The current server php version is&nbsp;PHP 7.1.33 (cli) (built: Oct 25 2019 11:33:58) ( NTS ). Using a shell program (I used Terminal) from the home directory I ran: export PATH=/opt/plesk/php/7.3/bin:$PATH; centos 6...
Andrew Fletcher20 Jan 2021
mod_fcgid timeout and reading data errors
Attempting to load changes in a staging site and the bountiful error page of Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator to inform of the time the error occurred and of...