Setting up Openfire Chat Server on Ubuntu 12.04

Ever since Ubuntu stopped bundling sun java in it’s repositories, it has been a nightmare for installing openfire on Ubuntu. The openjdk, sort of works, but some still prefer oracle’s (ahem – sun Smile ) Java Run time.

Openfire is an open source jabber based Instant Messaging chat system with one of the strongest feature set and simplistic user interface (read as web based interface providing good integration with Microsoft environment). This post will essentially take you through the pain of installing sun java renamed as oracle java on an Ubuntu Server 12.04. I always choose Ubuntu 12.04 because it is the most stable version Ubuntu has released and a server because it is very light on resources without any graphical interface. The down side you need to rely on terminal, ssh and patience Smile

There is a fully functional debian installer which obviously works with Ubuntu for openfire and can be downloaded from http://www.igniterealtime.org/downloads/index.jsp

Following are the steps you need to follow to get openfire to work on Ubuntu 12.04

  1. Pre-requisites
    • Ubuntu 12.04 server or desktop. Server is preferred for obvious reasons
    • Follow it up with recent updates (sudo apt-get update && upgrade)
    • hostname : testim (you can have whatever you want)
    • Hardware – Generally for a user base of ~ 200, you should consider at least
      • 1 GB RAM
      • 1 core
      • 10 GB of hard disk space
    • Static IP: 192.168.1.25
    • Other Applications
      • Webserver – Apache
      • Database – MySQL – You can use openfire’s embedded database, but I prefer a more manageable and robust database
      • Java – Oracle Java
    • Internet and firewalls
      • Fast internet – Lots of downloads will happen
      • Firewall or UTM – In a corporate environment, ensure the Openfire server gets unrestricted internet without any content filtering or download limits – at least till the installation is completely done. It is a LAN to WAN traffic, so should be quite safe
  2. Installing Pre-requisite Applications
    • Webserver & Database with following commands
      • sudo apt-get install apache2 mysql-server-5.5 phpmyadmin php5 php5-ldap python-software-properties
      • php5-ldap is required if you want user authentication based on Microsoft Active Directory or LDAP servers such as openldap
      • You can install the database on a separate server – totally up to you. I am installing it on the same server. If you install it on a different server, you may need to comment out ‘bind address’ argument in /etc/mysql/my.cnf so that the mysql database can accept connections from any server.
    • Java
      • sudo add-apt-repository ppa:webupd8team/java
      • It will ask you to confirm importing a key –> Accept
      • sudo apt-get update
      • sudo apt-get remove –purge openjdk*
      • sudo apt-get install oracle-java7-installer
      • Several pop-ups to accept agreements etc. Accept them
      • java –version (once the installer has finished)
  3. Installing Openfire
    • Assuming you have downloaded the latest openfire debian installer, run the following command from the folder in which you have stored the installer – sudo dpkg –i <name of the file>
    • Openfire has been installed but not ready yet to start
    • sudo apt-get install rpl
    • sudo rpl ‘6-sun‘ ‘7-oracle‘ /etc/init.d/openfire
  4. Configuring Openfire
    • Use following steps to create a database using web GUI using phpmyadmin
      • Go to http://192.168.1.25/phpmyadmin in a browser
      • Use uid as root & password as whatever you kept while installing MySQL database in step 2 above
      • create a database, user and give grant privileges – You can use that suits you
        • database – openfire
        • user – openfire
        • password – password
    • Use following steps for creating a database in MySQL using terminal. I am assuming the database is on the same server as where you are installing openfire
      • sudo mysql -u root –p
      • mysql> CREATE DATABASE openfire CHARACTER SET=’utf8′;
      • mysql> CREATE USER ‘openfire’@’localhost’ IDENTIFIED BY ‘password‘;
      • mysql> GRANT ALL PRIVILEGES ON `openfire`.* TO ‘openfire’@’localhost’ WITH GRANT OPTION;
      • mysql> FLUSH PRIVILEGES;
      • mysql> quit
    • sudo service openfire start
    • Open a browser and http://192.168.1.25:9090/setup/index.jsp
    • Follow the instructions and you are all set to have a fully functional openfire
    • Once the server is up and running, to avoid java memory leak do the following
      • In the Openfire Admin console goto System Properties
      • In Add new Property ( You will have to scroll down alll the way), add
        • Property Name: xmpp.pep.enabled
        • Value: false
      • sudo service opefire restart
  5. Don’t Forget to
    • activate firewall on the server (see my blog on using UFW). Run following to ensure you are safe on the server
      • sudo ufw enable
      • sudo ufw allow ssh
      • sudo ufw default deny
      • sudo ufw allow 9090/tcp
      • sudo ufw allow 9091/tcp
      • sudo ufw allow 5222/tcp
      • sudo ufw allow 7777/tcp
      • sudo ufw allow 7443/tcp
      • sudo ufw allow 7070/tcp
      • sudo ufw allow 3478/tcp
      • sudo ufw allow 3479/tcp
    • Explore plethora of plugins in the openfire server.
  6. Enjoy your Instant Messaging Server
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s