You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

Welcome to our guide on How to Install Openfire XMPP chat server on Ubuntu 18.04 |16.04. Openfire is a popular and powerful instant messaging (IM) server utilizing XMPP/Jabber protocol. Openfire also has all features of a decent Presence Server.

For CentOS 7 Server, check -> Install Openfire XMPP chat server on Centos 7.x

Openfire has proven to be the base for a range of products that use XMPP. By using plugins like Asterisk IM plugin, you can extend its features by integrating it into third-party tools.

Openfire can be defined also as real-time collaboration (RTC) server that requires a client to use it, but heaps of clients that support the XMPP protocol are available. The most popular one delivered by same developers that designed Openfire is the Spark.

XMPP( Extensible Messaging and Presence Protocol) is a widely adopted open protocol for instant messaging. It is a real-time communication protocol (which includes chat) based on XML.
Openfire provides cool features like:

  • MySQL, Oracle, PostgreSQL and embedded database support for user details and massages storage.
  • LDAP integration support
  • Support both TLS and SSL for security
  • Web GUI configuration manager
  • Spark IM client integration
  • A lot of plugins to extend its functionality
  • Clustering to avoid a single point of failure
  • Integrating with other external IM servers

Installing Openfire on Ubuntu 18.04 | Ubuntu 16.04

Installation of Openfire on Ubuntu 18.04 is a pretty straightforward process. Follow steps below to have Openfire installed and configured on your system.

Step 1: Update system packages:

Ensure all packages on your Ubuntu 18.04 system are up to date:

sudo apt-get update
sudo apt-get upgrade

Step 2: Install JAVA JDK

Once the packages are updated, install openjdk-8-jdk or 9 if you wish. openjdk-8-jdk package is available on Ubuntu official repositories. Installing by running the command:

$ sudo apt-get install openjdk-8-jdk
$ java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.18.04.1-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)

Step 3: Install MySQL/MariaDB or PostgreSQL Database server

You can choose a database from supported database servers. For this setup, we’ll Install  MariaDB or MySQL.

sudo apt install mariadb-server

Create database user:

Create database for openfire:

$ sudo mysql -u root
CREATE DATABASE openfire;
GRANT ALL PRIVILEGES ON openfire.* TO [email protected] IDENTIFIED BY '[email protected]!';
FLUSH PRIVILEGES;
QUIT

Later we will import Openfire database data.

Step 4: Download and Install Openfire

Download Openfire package. You can get the latest version from the Download link. As of this writing, the latest version is Openfire 4.5.2.

wget https://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_4.5.2_all.deb -O openfire.deb

Let’s now install it:

sudo  dpkg -i openfire.deb 

Check application status:

$ systemctl status openfire
● openfire.service - LSB: Start/stop openfire jabber server
Loaded: loaded (/etc/init.d/openfire; generated)
Active: active (running) since Tue 2018-06-26 12:00:06 UTC; 9min ago
Docs: man:systemd-sysv-generator(8)
Tasks: 22 (limit: 1153)
CGroup: /system.slice/openfire.service
└─28050 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -server -DopenfireHome=/usr/share/openfire -Dopenfire.lib.dir=/usr/share/openfire/lib -classpath /usr/sh

Jun 26 12:00:06 haproxy-01 systemd[1]: Starting LSB: Start/stop openfire jabber server...
Jun 26 12:00:06 haproxy-01 openfire[28035]: best java alternative in: /usr/lib/jvm/java-8-openjdk-amd64/jre
Jun 26 12:00:06 haproxy-01 openfire[28035]: Starting openfire: openfire.
Jun 26 12:00:06 haproxy-01 systemd[1]: Started LSB: Start/stop openfire jabber server.

Import Openfire database schema:

$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.22-0ubuntu18.04.1 (Ubuntu)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use openfire;
Database changed
mysql> source /usr/share/openfire/resources/database/openfire_mysql.sql;
mysql> show tables;

Step 5: Configure Firewall and Access Openfire UI

If you have an active firewall service, you need to allow ports for Openfire. My Ubuntu 18.04 system runs ufw:

$ sudo ufw enable
$ for i in 9090 9091 5222 7777; do 
sudo ufw allow $i; done

To access GUI, you’ll use Server’s ip address and the port 9090:

http://<server-ip|domain>:9090

You will get Openfire configuration window:

Select your default language then click Continue.  On Server setup window, set your domain and click Continue button.

We’ll use the following Configuration Parameters.
Database Driver Presets:MySQL
JDBC Driver Class: com.mysql.jdbc.Driver
Database URL:jdbc:mysql://127.0.0.1/openfire?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8
Username: openfire
Password: password123!

Click Continue and use Default option on Profile Settings; You can later add external authentication mechanisms like LDAP

Set admin user email address and password:

Click Continue to finish configuration. You’ll get a login page, login with admin as username and provide password  configured above.

If everything went well, you should get Openfire Management interface:

For further reading, check:

Configuring Mapping between Openfire XMPP users and Asterisk SIP users

How to Integrate Openfire XMPP Chat Server with Asterisk PBX server

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF