## Tuesday, February 23, 2010

### Installing ejabberd on Ubuntu

Recently I've installed ejabberd server on Ubuntu box. Thanks to this nice document, the process was pretty straightforward. My experience was little bit different from the author's one, so I want to show here exact steps I did to make it work, maybe it will be helpful for you too.

The first step is to install the required package. You can use Synaptic Package Manager or just command line:

sudo apt-get install ejabberd

During the installation a new user, ejabberd, will be created in the system. This is the user the server will be running on. When installation is finished ejabberd server is started. To configure the server you need to stop it

sudo /etc/init.d/ejabberd stop

Next step is to configure administrator and hosts. Open /etc/ejabberd/ejabberd.cfg file for edit and make the following change

%% Admin user{acl, admin, {user, "andrey", "jabber.ndpar.com"}}.%% Hostname{hosts, ["localhost", "ubuntu", "jabber.ndpar.com"]}.

For admin you need to specify the user name and domain name that you want to use as a Jabber ID. By default it's localhost and it's functional but it's better to change it to something meaningful. The list of hostnames is tricky. In theory you can provide there just localhost but in practice it didn't work for me. After digging into some Erlang exceptions I got while registering admin account (see next step) I came to conclusion that in the list of hostnames there must be a short hostname of the box. You can get it by running hostname -s command (in my case it was "ubuntu"). In addition you can provide other hostnames you like, but the short one is mandatory.

When you are done with editing, start the server

sudo /etc/init.d/ejabberd start

Now it's time to register the admin user we configured on the previous step. Run the following command replacing password placeholders with the actual password and providing user name and domain name from ejabberd.cfg file

sudo ejabberdctl register andrey jabber.ndpar.com xxxxxx

That's it! You have now working XMPP server with one registered user. To verify that everything is ok, in your browser go to the admin page of the server (http://jabber.ndpar.com:5280/admin) and check the statistics. You'll be asked to type your JID and password, so use the information you entered on the previous step

As a note, I didn't create my own SSL certificate because for isolated intranet the default one is quite enough. If you are not comfortable with that feel free to create a new certificate following the steps from the original article.

Click OK button, accept security certificate permanently and go online.

Now, to really enjoy IM you need more users on your server. The best part here is that you can create new users just from your Jabber client. You can actually do many things from the client, and you don't need to ssh to the remote server and run command for that. Just go to File -> your ejabberd account, and chose whatever you need from the menu

Pretty cool, eh — client and admin tool in one place.

Abdul Aziz said...

Hi,

Thanks for this wonderful post,

I have tried to follow your steps. I have installed ejabbered and configured the same. When i go to the link

( in my case http://jabber.abdul.com:5280/admin), I get a connection timed out error. localhost:5280/admin works though. I have added jabber.abdul.com to the config file as required. Am I missing something ?

Any help would be greatly appreciated.

Abdul Aziz

Andrey Paramonov said...

Hi Abdul,

Try to ping or telnet your host:

ping jabber.abdul.com
telnet jabber.abdul.com 5280

If those commands also time out, check your /etc/hosts file and make sure you have entry for your host, something like this

127.0.0.1 jabber.abdul.com

Anonymous said...

Thanks for this. Also, would like to point out a tip of advice in regards of too many remove/install's of XMPP server software, causing ejabber daemon to choke. This happened to me. It would not start, the 'starting...' process generated dots which would not come to an end. I tried 'remove --purge' and (re)install several times, nothing good came. Finally, I tried 'apt-get remove erlang* --purge', and then I pulled yet another 'apt-get install ejabberd'. This time it worked. Amazing. This was on 10.10/maverick btw. Cheers!

hi dude,
i followed your steps and everything worked. but i removed my configuration file and installed everything from scratch and now am getting a weired error

root@atul-laptop:/var/lib/ejabberd# ejabberdctl status
The node 'ejabberd@atul-laptop' is started with status: started
ejabberd is not running in that node
Check for error messages: ejabberd.log
or other files in that directory.

ejabberd@atul-laptop was my admin and host name of my first configuration.

your help is needed. i suspect its because of the Mnesia DB

Gaurav said...

Same error, i guess too many erlang processes had cache which was the problem. Killed the processes and the problem solved!

Cool i fixed it.

it was because of running erlang process .

i had to \$ killall beam

and its done.

:D

Anonymous said...

Thanks, Great help
Running ejabberd on our LAN, similar problem to Abdul, therefore had to add jabber.xyz.com to our DNS. Connection problem solved. However, I get an Error 403 when trying the Add User (using an Admin account).

Hi,

When we install ejabberd on windows, the application's hostname (like jabber.ndpar.com) would have to be specified in the windows' hosts file,right?. On ubuntu, is there similarly a file where I should specify the host name? (apart from specifying it in the ejabberd.cfg).

Hi,

after installed ejabberd on ubuntu, as follows your instruction for change the admin details in the ejabberd.cfg file.

After that i tried to start the ejabberd it showing the error message like
"RPC failed on node ejabbered@madan-laptop nodedown"

Please kindly tell me where is problem..

Leo Arias said...

Thanks a lot.

Now I have my ejabberd running :D

Just one note. In order to connect to gmail and other servers, SRV DNS records have to be added.

http://library.linode.com/communications/xmpp/ejabberd/ubuntu-9.04-jaunty#sph_xmpp-federation-and-dns

Anonymous said...

Hi, the document you reference (the hyperlink) is not valid. I would appreciate it if you would provide the document name that you followed originally to install jabber on ubuntu. Also, do you have experience, once the jabber server is installed, how to configure it to connect to a mySQL Database? Can I connect to the 1.4 version of the jabber mysql db or do I need to bring up a new DB, import the schema, than copy over the config files? Sherri

Anurag said...

Hello Andrey,

I tried to install on windows7 and follow all the steps. but when i check status its show:
The node ejabberd@localhost is started with status: started
ejabberd 2.1.11 is running in that node

and when i try to connect my client application to server i got this message:
E(<0.414.0>:ejabberd_http_bind:1236) : You are trying to use BOSH (HTTP Bind) in host "localhost", but the module mod_http_bind is not started in that host. Configure your BOSH client to connect to the correct host, or add your desired host to the configuration, or check your 'modules' section in your ejabberd configuration file.

I am giving host name DS-160ZPS, but module always start at ejabberd@localhost.

Hello,

Can i have install ejabberd on Linux Server ?

Hello everybody,

Can i install the ejabberd on my Linux server ?

Andrey Paramonov said...

Yes, you can.

Dear Sir,
I got following error after installing ejabberd on my ubuntu server