User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active
 

 

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, "mell", "192.168.1.99"}}.
%% Hostname
{hosts, ["localhost", "192.168.1.99"]}.

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 mell 192.168.1.99 mypassword

 

Now you can go to http://yourserver:5280/admin and enter the user name and password

For adding users you need to drill down to the server

http://192.168.1.99:5280/admin/server/192.168.1.99/

 

 

 

Another note: if you want groups enabled you will need to make one more change to /etc/ejabberd/ejabberd.cfg

remove the %% from in front of {mod_shared_roster,[]},

So change: %%{mod_shared_roster,[]},

to: {mod_shared_roster,[]},

and restart the service

 

Note when adding users to a roster or group remember to use the full context like: mell@192.168.1.99

 

Jabber XMMP Client:

Spark - http://www.igniterealtime.org/downloads/index.jsp

 

Ports:

5222 TCP     XMPP client connection (RFC 3920)        Official  
5223 TCP     XMPP client connection over SSL          Unofficial
5269 TCP     XMPP server connection (RFC 3920)        Official
5298 TCP UDP XMPP JEP-0174: Link-Local Messaging /    Official
             XEP-0174: Serverless Messaging
8010 TCP     XMPP File transfers                      Unofficial    

The port numbers are defined in RFC 3920:




Now the pesky cert that will keep yelling at you when you connect
this is what I did:
cd /
mkdir cert
openssl req -new -x509 -newkey rsa:1024 -days 3650 -keyout privkey.pem -out server.pem
note: Common Name is domain.
openssl rsa -in privkey.pem -out privkey.pem
cat privkey.pem >> server.pem
rm privkey.pem
mv server.pem /etc/ejabberd/server.pem
chown root:ejabberd /etc/ejabberd/server.pem
chmod 640 /etc/ejabberd/server.pem

didn't even need to restart the server