How to install Openfire XMPP Chat Server on Ubuntu 22.04

Estimated reading: 4 minutes 402 views

Welcome to our guide on How to Install the Openfire XMPP chat server on Ubuntu 22.04. Openfire is a popular and powerful instant messaging (IM) server utilizing XMPP/Jabber protocol. Openfire also has all the features of a decent Presence Server.
Openfire has proven to be the base for a range of products that use XMPP. By using plugins like the Asterisk IM plugin, you can extend its features by integrating it into third-party tools.

Openfire can be defined also as a 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 message 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 XMPP on Ubuntu 22.04

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

Step 1: Update system packages:

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

apt update
apt 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:

$ apt install default-jdk
$ java -version

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.

apt install mariadb-server

Create a database and user for openfire:

$ mysql -u root
CREATE DATABASE openfire;
GRANT ALL PRIVILEGES ON openfire.* TO openfire@localhost IDENTIFIED BY 'Green@1234';
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.6.7.

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

Let’s now install it:

apt install -f ./openfire.deb 

Check application status:

$ systemctl status openfire

Import Openfire database schema:

$ mysql -u root -p
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 system runs ufw:

for i in 9090 9091 5222 7777; do 
  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 the Openfire configuration window:

Select your default language then click Continue.  On the Server setup window, set your domain and click the 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: Green@1234

Click Continue and use the 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 the configuration. You’ll get a login page, log in with admin as username, and provide the password configured above.

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