Jabber Messaging Server
Build your own Instant Messenger Server.. (FreeBSD 6.1)
Posted 29.09.2006 | Updated 23.11.2006 | Contributed by Andy Mallett


Most of us have some kind of internet connection these days, so it's easy to connect to externally provided, free web-based chat servers and catch up on the gos'.

What with all these services being free, not to mention having thousands of subscribers, there's not a whole lot of reasons for setting up your own server.

However, my chum Andrew 'Locomotive' Cover and I have been experimenting rather extensively with our wireless WAN and needed some convenient way to communicate without an internet connection. So here's how to set up a Messaging Server in 5 easy steps..

Introduction

From the Jabber.org website..

Jabber is best known as "the Linux of instant messaging" -- an open, secure, ad-free alternative to consumer IM services like AIM, ICQ, MSN, and Yahoo. Jabber is a set of streaming XML protocols and technologies that enable any two entities on the Internet to exchange messages, presence, and other structured information in close to real time.

Jabber Software Foundation

So Jabber is the all-encompassing open solution to instant messaging. The implementation of the Jabber server we will be using is the highly-respected Wildfire Server, from Jive Software. Finally we will connect to the Jabber/Wildfire Server using a chat client such as Psi.

1. Installing the Linux Emulator

Wildfire runs on Java and the included installer for java is in the form of a Linux binary. Hence Linux Binary compatibility must be enabled in FreeBSD. If this was not done during installation, follow these instructions.. Insert the FreeBSD 6.1 installation CD..

sysinstall
configure
packages
cd/dvd
linux
linux_base-8-8.0_14 /usr/ports/emulators/linux_base-8 (spacebar to select)  OK
tab to Install  OK
after install, tab to EXIT

1a. Enabling Linux Binary Support

Edit rc.conf..

vi  /etc/rc.conf

Add the following line..

linux_enable="YES"

And then reboot the system.

2. Installing the Java Runtime Environment

Wildfire requires Java version 1.5x or above. It is not necessary to install the full Java Development Kit (JDK) unless you plan to undertake further development of the platform. The more slimline Java Runtime Environment (JRE) will suffice..

Grab the Java Runtime Environment (JRE) 5.0 Update 8 jre-1_5_0_08-linux-i586.bin) from the Sun Java website (16.2MB) and download to your usual source files directory, such as /src.

Make the file executable, load the linux module into memory and then run the self-extractor/installer..

cd  /src
chmod  755  jre-1_5_0_08-linux-i586.bin
./jre-1_5_0_08-linux-i586.bin

Scroll down the licence agreement and accept by typing 'yes'
The installer automatically extracts all the files and ends with a final 'Done'.

You should end up with something like /src/jre1.5.0_08. Move the java JRE directory from /src to /usr/local..

mv  jre1.5.0_08   /usr/local

And that's it for the java part, Wildfire will look for these Java files at /usr/local/jre1.5.0_08

3. Installing the Wildfire Server

Grab wildfire_3_1_0_beta_2.tar.gz (5.7MB) from the web and download to to your usual source files directory, such as /src. Extract the wildfire files and move the extracted wildfire directory from /src/wildfire to /usr/local..

cd  /src
tar  -zxvf  wildfire_3_1_0_beta_2.tar.gz
mv  wildfire  /usr/local

4. Starting the Wildfire Server

Start the wildfire service with the following command..

/usr/local/wildfire/bin/wildfire  start  (press ENTER twice)

Wildfire will locate the required java environment and start itself up. To stop the wildfire service, type..

/usr/local/wildfire/bin/wildfire  stop

5. Configuring the Wildfire Server

Wildfire is configurable through its own web interface (Apache not required). Connect to the server from a web browser, using its IP Address or hostname, on port 9090..

i.e. http://192.168.0.222:9090 or http://servername.domainname:9090

Upon first connection, you will be plunged into a mini setup wizard for configuring the basics, such as Chat Server name and admin password, etc. Follow the prompts and the server should be ready to go.


Wildfire by Jive Software

Problems

I ran into a whole host of problems which took a week of late evenings to resolve. Hopefully I have managed to circumvent most issues through my instructions.

Note that FreeBSD.org indicates a method of installing Java through ports. I attempted this but ran into dependency (and virtual memory!) problems and would not recommend this method. The latest versions of FreeBSD have better support for Linux binaries. I had an easier time of it using FreeBSD 6.1 than earlier attempts using 5.4. Special thanks to my academic colleague Henry 'Programmer' Bush, for helpful hints and suggesting the alternative Linux binary method of installing Java.

The various Wildfire log files can be useful in diagnosing problems and these are located in /usr/local/wildfire/logs. See also /usr/local/wildfire/bin, including the nohup.out file.

I do get an error message in the latter file..

Java HotSpot(TM) Server VM warning: Can't detect initial thread stack location - find_vma failed

Despite this, the Wildfire Server is working fine. Various references indicate that this is a spurious error messsage which can be ignored. If you really can't live with this, then I found that running the command..

mount -t linprocfs linprocfs /compat/linux/proc

..seemed to fix this. For more assistance, you may find some of the links below useful..

Configuring a Chat Client

There are a number of MSN-like clients which can be used to communicate through the various types of Jabber Servers (see the Clients Comparison below). To start the ball rolling, here are the installation and configuration instructions for the Psi chat client.

Links and References

Wildfire Server at Jive Software
Servers Comparison at Jabber Software Foundation
Clients Comparison at Jabber Software Foundation

http://www.jivesoftware.org/builds/wildfire/docs/3.1.0_beta_2/documentation/install-guide.html
http://www.freebsd.org/java/install.html (this method not recommended for Java install)
http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/contents.html
http://java.sun.com/j2se/1.5.0/docs/tooldocs/linux/jdkfiles.html
http://www.cs.unc.edu/~jeffay/dirt/FAQ/linuxBinaryTips.html
http://java.sun.com/j2se/1.5.0/install-linux.html#problems
http://os.newsforge.com/os/06/03/22/1531252.shtml?tid=8&tid=2
http://www.jivesoftware.org/community/message.jspa?messageID=128103
http://wiki.jivesoftware.org/display/WILDFIRE/Linux+Installation+Guide
http://www.jivesoftware.org/community/thread.jspa?messageID=128967
http://forum.java.sun.com/thread.jspa?threadID=542672&messageID=2880153