ClassHelper.org US Site  ClassHelper.org UK Site  
ClassHelper News
About ClassHelper.org
Our Education Blog
Free Math Resources
Free School Clip Art
Crossword Puzzles
Word Find Puzzles
Cryptogram Puzzles
Word Jumble Puzzles
Coloring Book Pages
Computer Science
View Our Sitemap
Privacy Policy

Valid XHTML 1.0 Transitional


Build Your Own Openfire Chat Server on Debian Linux (Page 1)

Phil Paradis

By Philip C. Paradis
April 10, 2009

For those unfamiliar with Openfire, it's an extremely capable real-time collaboration system. Published under the GPL, this open source system allows administrators to easily set up a flexible chat server (for use with Jabber clients, along with gateways to other IM systems), although it's able to do much more than simple chat. This tutorial will teach you how to install Openfire on a Debian 5 (Lenny) server. For my purposes, I chose to set up a dedicated virtual machine for Openfire using VMware Server. This allows me to give the server its own isolated environment, making installation and ongoing management easier.

This material has also been tested on a Linode Linux VPS (ClassHelper has been hosted on a Linode for years). If you don't have your own server, get a Linode today. As a disclaimer, I do work for Linode, but I was a very satisfied customer for over five years prior to joining the company.

If you haven't installed Debian before, I recommend starting with the relevant Debian server installation steps outlined in an earlier tutorial. You'll want to change the server's hostname to something that reflects its purpose. I named my server "openfire" to keep things simple. With respect to package groups, you'll want to install a base Debian system with the OpenSSH server installed afterward for easy administration. Be sure to assign a static IP to your server and add an entry to your organization's DNS server to point to it. For testing purposes, you can simply add an entry to your workstation's hosts file.

Once your base Debian system is installed, you'll need to add support for the non-free repositories to your apt sources list. Edit the file /etc/apt/sources.list with your favorite shell editor (I like nano), and update it to look like mine. Your server entries may vary by geographic location.

deb http://ftp.us.debian.org/debian/ lenny main contrib non-free
deb-src http://ftp.us.debian.org/debian/ lenny main

deb http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://security.debian.org/ lenny/updates main

deb http://volatile.debian.org/debian-volatile lenny/volatile main
deb-src http://volatile.debian.org/debian-volatile lenny/volatile main

Next, we need to install some prerequisite packages. Openfire uses Java, and this tutorial uses the Postgresql database for storage. You could opt to use Openfire's built-in storage system, but I prefer to keep my data in a real relational database. It makes using the data for other purposes (such as analyzing logs) much easier. Note that the apt-get install command shown below must go on one line.

apt-get update
apt-get upgrade --show-upgraded
apt-get install sun-java6-jre sun-java6-fonts postgresql postgresql-client ident2

After installing the prerequisites (you'll need to accept the Sun license to install Java), you'll need to visit the Openfire download page to get the URL for the current version. This tutorial uses version 3.6.3, but it may be updated by the time you read this. After getting a valid link to the current version, download it on your server as follows:

wget http://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_3.6.3_all.deb

Install the package using dpkg, as shown below.

dpkg -i openfire_3.6.3_all.deb

Now it's time to set up a Postgresql database for Openfire. First, we need to edit the /etc/postgresql-8.3/pg_hba.conf file (the Postgresql directory may vary if another release occurs before you read this) and change some authentication settings. Modify your file to reflect the entries shown below:

# "local" is for Unix domain socket connections only
local   all         all                               password
# IPv4 local connections:
host    all         all         127.0.0.1/32          password
# IPv6 local connections:
host    all         all         ::1/128               md5

Restart Postgresql to use the new settings.

/etc/init.d/postgresql-8.3 restart

Enter the commands shown below to create the openfire Postgresql user and set up the database. When asked about user roles, specify "no" for superuser, "yes" for allowed to create databases, and "no" for allowed to specify new roles. Be sure to make a note of the password you assign to the new database user.

su - postgres
createuser openfire -P
exit
cd /usr/share/openfire/resources/database
createdb -W -U openfire -E UNICODE openfire
psql -U openfire -W -d openfire -f openfire_postgresql.sql

Continue - Openfire Configuration