Installing jabberd2 and MySQL on Ubuntu 8.10

I mentioned in my last post that I had got a new VPS to host my “my mail and some other things” on. One of those other things is a Jabber / XMPP server for instant messaging.

There are many XMPP servers out there, and at least three of them are available in Ubuntu’s software repository: jabberd14, jabberd2, and ejabberd. There is also the popular Openfire server, which isn’t available in the Ubuntu repository but a breeze to install nevertheless through its web-based configuration UI.

My VPS does not come with a whole lot of memory, so I needed a Jabber server with a small memory footprint. Although you can trim the Java-based Openfire down to fairly low levels of memory usage, it’s at a disadvantage compared to the C/C++ based jabberd14 and jabberd2. The same goes for the Erlang-based ejabberd, so it came down to jabber14 or jabberd2. Considering that jabberd14 seems pretty dead with no updates since 2007, I chose jabberd2. This is how I installed it:

Step 1 — add universe to sources.list
The universe repository component needs to be enabled in /etc/apt/sources.list, see step 4 in my last post for how to do this.

Step 2 — install MySQL
jabberd2 can be used with several different storage and authentication backends. I prefer the default Ubuntu choices of MySQL for both storage and authentication, as I use MySQL for different things too and I like simplicity. If you don’t have it installed already, get it by:

sudo apt-get install mysql-server

Still hunting for a small memory footprint, I also switched the default MySQL config to the stock config for systems with little memory:

sudo cp /etc/mysql/my.cnf /etc/mysql/my.cnf.backup
sudo cp /usr/share/doc/mysql-server-5.0/examples/my-small.cnf /etc/mysql/my.cnf
sudo /etc/init.d/mysql restart

Somewhat disappointingly, MySQL still hogs more than 100 MB of precious memory, which is a bit funny since the config claims it’s meant to be used for systems with less than 64 MB of memory. 😉 However, if you don’t plan to use InnoDB tables, the magic-wand solution is to add the skip-innodb directive to the [mysqld] section of /etc/mysql/my.cnf. This alone brought the memory usage down to just 15 MB after startup for me.

Step 3 — install jabberd2
Get jabberd2 from universe by:

sudo apt-get install jabberd2

For some reason it seems to start up by default even though it’s not properly set up yet, so let’s shut it down while we’re configuring it:

sudo /etc/init.d/jabberd2 stop

Then create the necessary database and tables in MySQL:

gzip -d /usr/share/doc/jabberd2/db-setup.mysql.gz
mysql -u root -p
mysql> \. /usr/share/doc/jabberd2/db-setup.mysql
mysql> GRANT select,insert,delete,update ON jabberd2.* to jabberd2@localhost IDENTIFIED by 'secret';
mysql> quit

Replace ‘secret’ in the grant statement above with the password you want to use for the jabberd2 user. You’ll need this password in the steps below.

Step 4 — configure jabberd2
Essentially, configuring jabberd2 for MySQL boils down to three basic steps, decently covered in the official installation guide:

Additionally, it makes sense to also change the password of the jabberd2 backbone router component in router-users.xml and each of the component configuration files.

Although there are other configuration options available too, the above steps should be enough for a basic installation. Start jabberd2 up again through:

sudo /etc/init.d/jabberd2 restart

At this point, you should be able to connect to the server and register with an IM client of your choice, e.g. Miranda. Don’t forget to open up the Jabber ports in your firewall: port 5222 for normal connections, 5223 for SSL connections, and 5269 for server-to-server connections.

Advertisements

15 responses to “Installing jabberd2 and MySQL on Ubuntu 8.10

  1. Pingback: links for 2009-03-21 « Bloggitation

  2. Helllo,

    I’m using Ubuntu Jaunty 9.04 with jabberd2, but it’s not working. There are no erros on the logs, I can telnet to it, so it’s responds. I tryed Spark, IM+ and Mirand, neither works.

  3. devdoodles

    Unfortunately I haven’t tried Ubuntu 9 yet so I’m not sure if you need to do anything different there to get it to work. I did once have problems connecting to jabberd2 with Miranda, but after upgrading to a new version of Miranda it started to work. I can’t remember the error but there was a connect error message in the jabber server logs, so I guess your problem is different.

    I’m afraid I don’t have any good recommendations except troubleshooting by enabling debug mode / logging in your client or connect through telnet and issue basic jabber commands manually, to see what response you get… and make sure you don’t have any firewall rules that blocks your IM clients but not telnet. Not much help, I know, but good luck anyway. 🙂

    Update: I have now installed jabberd2 on Ubuntu 9.04 according to the steps above, and it worked just fine.

  4. Quang Nguyen

    Hi devdoodles !
    I have tried your way,but i don’t know how i configure c2s.xml and sm.xml files. could you send to me any example files, please ?
    I use Ubuntu 8.10 desktop.

    Thanks you !

  5. devdoodles

    The only things you really need to change in c2s.xml and sm.xml are described in the documentation sections pointed to by the three links I posted above:

    http://jabberd2.xiaoka.com/wiki/InstallGuide/BasicConfiguration#set-sm-c2s-hostname
    http://jabberd2.xiaoka.com/wiki/InstallGuide/BasicConfiguration#a4.4.2.ConfigureforStorageusingMySQLsm.xml
    http://jabberd2.xiaoka.com/wiki/InstallGuide/BasicConfiguration#a4.4.3.ConfigureforAuthenticationusingMySQLc2s.xml

    That is, your jabber server name and the MySQL server name and authentication details.

    Good luck!

  6. how can i connect claros chat 1.0 client with jabberd2 server.
    Abhay

  7. the links which u have given for miranda client are all exes..
    is there any miranda client for ubuntu machine??

  8. devdoodles

    Never tried Claros so can’t help you there. Miranda is for Windows only, but e.g. Psi works in Ubuntu. You should be able to install it with apt-get.

    That being said, I’ve had problems connecting to jabberd2 with some other jabber clients, e.g. iChat and Pidgin, but I’m not sure if that’s an inherent problem with jabberd2 or just a problem with my install.

  9. So, I’ve been trying to get jabberd2 configured all night under Ubuntu 9.04 and I have had no luck connecting to it at all. Have any advice?

  10. Lacking any other information, the only suggestion I have is to try connecting with a client that I know works, to rule out that as a problem (see above comments). Clients that work for me are Psi in Ubuntu, Adium in Mac OS X, and Miranda in Windows. Good luck!

  11. hey there… I’ve successfully installed jabberd2 on ubuntu 9.04… there are a few .deb errors :P… you need to install a bunch of dependencies as -dev instead of the regular

  12. libexpat1-dev
    libidn11-dev
    libudns-dev
    libgsasl7-dev
    are all I found missing 😀

  13. Thanks for the excellent tip about innodb.
    That’s one thing I did not catch when I tried to reduce my memory usage in on an Ibex server.

    I’m on my way to trying jabber2 -:)

    – dave

  14. Hi devdoodles ,
    looks like all the links are dead or point to materials as of yet not published. Anywhere else we can look?

    best, with thanks

  15. devdoodles

    It seems the jabberd2 site has changed since I wrote the post. I’ve updated the links now and I believe they match the old ones fairly accurately. Thanks for the notice!