Jump to content


- - - - -

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


If you 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.
If you 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.
This guide is intended as a relatively easy step by step guide to:

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.
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 :
java -version
2. Create new MySQL database for Openfire.
  • You have several options for user authentication including LDAP, MtSQL or embeded DB.
  • We will use the MySQL option and need to create a new database and user for Openfire to use.
  • Log in to MySQL as root. Open the Terminal window and enter :
sudo mysql -u root -p
  • Then enter the following to create the database and add user openfire. Replace openfirepasswrd with a new password :
mysql> CREATE DATABASE openfire CHARACTER SET='utf8';
mysql> CREATE USER 'openfire'@'localhost' IDENTIFIED BY 'openfirepasswrd';
mysql> GRANT ALL PRIVILEGES ON `openfire`.* TO 'openfire'@'localhost' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
mysql> quit
3. 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 enter :
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
4. Open firewall ports for Openfire.
  • You need to open some ports on your firewall for Openfire to work.
    • Port 9090 : for the web interface.
    • Port 9091 : for SSL web interface.
    • Port 5222 : the main port used for client/server communication by Openfire.
    • Port 7777 : used for file transfer.
    • Port 7443 : used for unsecured Http client connections.
    • Port 7070 : used for secure Http client connections.
    • Port 3478, 3479 : used by the STUN Servive for entities behind a NAT.
    • Complete port list used by Openfire available here.
  • If you are using ufw firewall open a terminal and enter:
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
5. Configure Openfire server with web admin console.
  • 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 .
Posted Image
  • 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
Posted Image
  • Some very important settings to consider are found under Server > Server Settings > Registration Settings
Posted Image
  • Then go to the User/Groups menu and add IM users.
Posted Image



How to remove openFire

First we need to stop the service:
sudo /etc/init.d/openfire stop

Now we need to remove from services:
sudo update-rc.d -f openfire remove
Now to remove it from startup file:
sudo rm /etc/init.d/openfire
Now to delete all the files located at /opt/openfire:
sudo rm -rf /opt/openfire
Last Item is to dump the database in mysql.


0 Comments