Install Openfire on Ubuntu 16.04 LTS Server
Install Openfire on Ubuntu 16.04 LTS Server
If you are looking out to setup your own private chat server OpenFire is a great open source instant messaging server licensed under the Open Source License that offers great service and also rock-solid performance. This real time collaboration server makes use of the XMPP protocol which is a real-time communication protocol based on XML also known as Jabber.
Let’s have a look on step by step installation guide of openfire on Ubuntu to build your own chat server.
Requirements:
Open fire work on many platform, but here we are discussing openfire installation on Ubuntu 16.04, so to install open fire on Ubuntu 16.04 you will require fresh installed Ubuntu server with MySQL install on it which will require for database connection and also latest JRE or JDk.
Install Java
sudo apt-get update
sudo apt-get install openjdk-8-jre
Above command will install JDK which is require to run open fire Server.
To check your Java version type following command.
java –version You will get following reply openjdk version “1.8.0_91″OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14)OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
Install and create Mysql Database for Open fire.
You have several options for user authentication including LDAP, MySQL or embeded DB.
We will use the MySQL option and need to create a new database and user for Openfire to use.
To install MySql use following command
sudo apt-get install mysql-server
Note: while installing MySql server you will get prompt for root password, keep this password in your record as you will need this password further in open fire installation.
Once your installation is complete get in to mysql and create database for openfire.
Use following commands to create database for open fire.
sudo mysql –u root –p (This command will prompt for mysql root password, type the password you have created during mysql installation time)
One you will get in to mysql prompt type following commands
mysql> CREATE DATABASE openfire CHARACTER SET=’utf8′;
mysql> CREATE USER ‘openfire’@’localhost’ IDENTIFIED BY ‘Type your password for openfireuser’;
mysql> GRANT ALL PRIVILEGES ON `openfire`.* TO ‘openfire’@’localhost’ WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
mysql> quit
Now its time to download and install Openfire.
Make sure you are downloading latest verstion of Openfire which you will find from here
Now use following commands to download.
cd /tmp
wget –o http://www.igniterealtime.org/downloads/download-landing.jsp?file=openfire/openfire_4.0.3_all.deb
After your donload will complete install openfire with following command.
sudo dpkg -i openfire_4.0.3_all.deb
or You can download TAR file and run it directly, to get tar file use following command wget http://www.igniterealtime.org/downloads/download-landing.jsp?file=openfire/openfire_4_0_3.tar.gz
Then use the tar utility to unpack the.tar.gz file like shown below.
tar –xvzf openfire_4_0_3.tar.gz
Now move extracted directory to to /opt directory with below command
sudo mv openfire /opt
Its time to start openfire,but before starting it make sure you have imported database from openfire server to the openfire database which we have created earlier.
Use following command
cd /opt/openfire/resources/database
cat openfire_mysql..sql | mysql [databaseName]; (in our case database name is openfire)
Now type below command to start open fire server
/opt/openfire/bin/openfire start
To start openfire automatically while rebooting your server add above command to rc.local
user following command vi /etc/rc.local
your file should look like below.
—————————————————————————————————————————————–
!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will “exit 0” on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/opt/openfire/bin/openfire start
exit 0
—————————————————————————————————————————————–
If you are planning to keep your server behind firewall, then open following port for open fire to work smoother.
Port 9090: for the web interface.
Port 9091: for SSL web interface.
Port 5222: the main port used for client/server communication by Open fire.
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 Service for entities behind a NAT.
Now you can access your server using http://localhost:9090 or http://youserverip:9090
ThankYou
I get pre-dependency problems. It complains and says it need openjdk-7-jre-headless, openjdk-7-jre, or oracle-java7-jre
Yes you have to install its dependencies its all mentioned in the article.