Important: this article is not released under a Creative Commons license and may not be copied or redistributed in any form. Please use our contact page to get in touch with us if you wish to reproduce the article.

How to setup an IM / VOIP server using Openfire on headless Ubuntu 12.04


Brent's Gravatar

Brent
published Dec. 10, 2013, 7:29 p.m.


If you are looking for an alternative to public IM and VOIP services like Skype and want to create a private secure IM / VOIP network, this guide is for you.

Requirements

Ubuntu 12.04 or later installed machine to act as local IM server machine and one to act as IM client - the client computer can also be Windows or Mac OSX based as long as you install the relevant Spark client on these machines.

Instructions

  1. Install Java 6/7 JRE or JDK.

    On each computer you want to be part of your IM network require at least Java 6 JRE to be installed. Oracle / Sun Java 6 is no longer available in the Software Center as Oracle has changed the license to make it complicated to install and update on Ubuntu. More information about Java on Ubuntu available here.

    The easiest way I have found is to install Java on Ubuntu is via the Web Upd8 PPA .

    First add the PPA. Open a Terminal Window and enter :

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    

    A good idea to minimise any Java conflicts is to remove OpenJDK. Open a Terminal Window and enter:

    sudo apt-get remove --purge openjdk*
    

    Then to install Oracle Java 6 version open a Terminal Window and enter :

    sudo apt-get install oracle-java6-installer
    

    To install Oracle Java 7 version open a Terminal Window and enter :

    sudo apt-get install oracle-java7-installer
    

Tip: Top check the Java version installed on your system open a terminal and enter:<br>java -version

  1. Create new MySQL database for Openfire.

  2. Install Openfire.

    The latest Debian version of Openfire can be downloaded from ignite realtime download page. Download Openfire 3.8.2 by opening a terminal window and entering:

    cd /tmp
    wget -O openfire_3.8.2_all.deb http://www.igniterea...e_3.8.2_all.deb
    

    Then install openfire. Open a Terminal window and enter:

     sudo dpkg -i openfire_3.8.2_all.deb
    

    Ignore all installation errors regarding user and folder permissions. As long as you do not get any Java version errors and openfire does install you are good to go.

    You need to point the openfire server startup file to the correct home folder of the Java version installed on your system. Replace java-6-sun with java-6-oracle or java-7-oracle depending on your version of java in the /etc/init.d/openfirefile in line 27, or open a terminal and enter:

    sudo apt-get install rpl
    sudo rpl '6-sun' '7-oracle' /etc/init.d/openfire
    sudo service openfire start
    

    Open firewall ports for Openfire. You need to open some ports on your firewall for Openfire to work.

    <table class="table table-striped"> <tr> <th>Port</th> <th>Description</th> </tr> <tr> <td>9090</td> <td>for the web interface</td> </tr> <tr> <td>9091</td> <td>for SSL web interface</td> </tr> <tr> <td>5222</td> <td>the main port used for client/server communication by Openfire</td> </tr> <tr> <td>7777</td> <td>used for file transfer</td> </tr> <tr> <td>7443</td> <td>used for unsecured Http client connections</td> </tr> <tr> <td>7070</td> <td>used for secure Http client connections</td> </tr> <tr> <td>3478, 3479</td> <td>used by the STUN Servive for entities behind a NAT</td> </tr> </table>

    The rest of the Openfire configuration will be done in the admin console. Replace mydomain below with your FQDN or IP address of your server. Open a browser and go to:

    http://mydomain:9090/setup/index.jsp

    You will be presented with the Openfire setup wizard. Follow the instructions. When asked select Database Settings > Standard Connection Make sure you enter the MySQL database hostname and database name in the Database URL line below - this is easily missed

    openfire-04

    When done you can login to the admin console with your openfire admin username and password on :

    http://mydomain:9090/index.jsp

    You can also login securely with SSL encryption enabled on:

    https://mydomain:9091/index.jsp

    openfire-01.png

    Some very important settings to consider are found under Server > Server Settings > Registration Settings

    openfire-05.png

    Then go to the User/Groups menu and add IM users.

    openfire-02.png