Share on Social Media

Discover how to install Openfire on CentOS 7 with our comprehensive guide. Follow our detailed instructions to configure Openfire Server on your CentOS 7 effortlessly. #centlinux #linux #xmpp

What is Openfire?

Openfire is a cross-platform real-time collaboration server developed in Java and based on the XMPP / Jabber protocol. Openfire is formerly known as Wildfire and Jive Messenger. It is developed by Jive Software and maintained by Ignite Realtime community. Openfire is free and open-source and distributed under Apache License 2.0.

In this article, we will install Openfire on CentOS 7 and then we will use Spark client to connect with our Openfire XMPP server.

System Specification

We have provisioned a CentOS 7 virtual machine with following specification.

  • Hostname – openfire-01.example.com
  • IP Address – 192.168.116.170 /24
  • Operating System – CentOS 7.6

We will configure the above CentOS 7 machine as Openfire server and used our Host machine (MS Windows) to install and test our Openfire server using Spark client.

Install MariaDB on CentOS 7

We will configure Openfire to use an external database for optimum performance. For this purpose, we are installing MariaDB database server using yum command.

# yum install -y mariadb-server

Enable and start MariaDB service.

# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
# systemctl start mariadb.service

Configure MariaDB instance as follows.

# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

MariaDB has been installed successfully. If you want to install a latest release of MariaDB then please refer to our previous article Installing MariaDB 10.3 Server on CentOS 7.

Install Openfire on CentOS 7

Connect with openfire-01.example.com using ssh as root user.

Download latest version (currently Openfire 4.3.2) from Ignite Realtime Website.

There are two variations of Openfire are available here i.e. with or without JRE. We recommend you to download and install the Openfire with JRE. Otherwise you have to explicitly install OpenJDK before installing Openfire without JRE.

# cd /tmp
# wget -O openfire-4.3.2-1.x86_64.rpm https://www.igniterealtime.org/downloadServlet?filename=openfire/openfire-4.3.2-1.x86_64.rpm
--2019-05-26 14:01:22--  https://github-production-release-asset-2e65be.s3.amazonaws.com/18511687/e1599f00-254c-11e9-86b4-af3416540b3e?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190526%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190526T090122Z&X-Amz-Expires=300&X-Amz-Signature=1b28d4b39d5ec17d56a6154fa0c24b51792790574cd3eb692b981f06d3582261&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dopenfire-4.3.2-1.x86_64.rpm&response-content-type=application%2Foctet-stream
Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.112.195
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.112.195|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 120645764 (115M) [application/octet-stream]
Saving to: âopenfire-4.3.2-1.x86_64.rpmâ

100%[======================================>] 120,645,764  573KB/s   in 4m 17s

2019-05-26 14:05:41 (458 KB/s) - âopenfire-4.3.2-1.x86_64.rpmâ saved [120645764/120645764]

Install Openfire package using rpm command.

# rpm -ivh openfire-4.3.2-1.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:openfire-4.3.2-1                 ################################# [100%]
Restarting openfire (via systemctl):                       [  OK  ]

Openfire service is already enabled during package installation, therefore, there we are only required to start it once.

# systemctl is-enabled openfire
openfire.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig openfire --level=5
enabled
# systemctl start openfire

Check the status of the Openfire service.

# systemctl status openfire
â openfire.service - SYSV: Openfire is an XMPP server, which is a server that facilitates XML based communication, such as chat.
   Loaded: loaded (/etc/rc.d/init.d/openfire; bad; vendor preset: disabled)
   Active: active (running) since Sun 2019-05-26 14:24:06 PKT; 1s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 15499 ExecStart=/etc/rc.d/init.d/openfire start (code=exited, status=0/SUCCESS)
 Main PID: 15513 (java)
   CGroup: /system.slice/openfire.service
           ⣠15513 /opt/openfire/jre/bin/java -Dlog4j.configurationFile=/opt/...

May 26 14:24:04 openfire-01.example.com systemd[1]: Starting SYSV: Openfire i...
May 26 14:24:05 openfire-01.example.com su[15511]: (to daemon) root on none
May 26 14:24:05 openfire-01.example.com openfire[15499]: Starting openfire:
May 26 14:24:06 openfire-01.example.com systemd[1]: Started SYSV: Openfire is...
Hint: Some lines were ellipsized, use -l to show in full.

Openfire Service is successfully started.

Configure Linux Firewall

Allow Openfire service ports in Linux firewall as follows.

# firewall-cmd --permanent --add-port={9090,5222}/tcp
success
# firewall-cmd --reload
success

Create Openfire Backend Database

Create a database for Openfire in MariaDB server.

# mysql -u root -p123
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 13
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> CREATE DATABASE openfire;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> GRANT ALL ON openfire.* to 'openfire'@'localhost' IDENTIFIED BY '123';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL ON openfire.* to 'openfire'@'openfire-01.example.com' IDENTIFIED BY '123';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> EXIT
Bye

Connect as openfire user and create database schema in openfire database using the scripts provided within Openfire home directory.

# mysql -u openfire -p123
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 15
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> USE openfire;
Database changed
MariaDB [openfire]> SOURCE /opt/openfire/resources/database/openfire_mysql.sql
Query OK, 0 rows affected (0.04 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Check list of tables in openfire database.

MariaDB [openfire]> SHOW TABLES;
+----------------------+
| Tables_in_openfire   |
+----------------------+
| ofExtComponentConf   |
| ofGroup              |
| ofGroupProp          |
| ofGroupUser          |
| ofID                 |
| ofMucAffiliation     |
| ofMucConversationLog |
| ofMucMember          |
| ofMucRoom            |
| ofMucRoomProp        |
| ofMucService         |
| ofMucServiceProp     |
| ofOffline            |
| ofPresence           |
| ofPrivacyList        |
| ofProperty           |
| ofPubsubAffiliation  |
| ofPubsubDefaultConf  |
| ofPubsubItem         |
| ofPubsubNode         |
| ofPubsubNodeGroups   |
| ofPubsubNodeJIDs     |
| ofPubsubSubscription |
| ofRemoteServerConf   |
| ofRoster             |
| ofRosterGroups       |
| ofSASLAuthorized     |
| ofSecurityAuditLog   |
| ofUser               |
| ofUserFlag           |
| ofUserProp           |
| ofVCard              |
| ofVersion            |
+----------------------+
33 rows in set (0.00 sec)

MariaDB [openfire]> EXIT
Bye

Configure Openfire server on CentOS 7

To start Openfire setup, browse URL http://openfire-01.example.com:9090/ in a client’s browser.

OpenFire Server - Language Selection
OpenFire Server – Language Selection

Choose your preferred language and click on Continue.

Openfire Server settings
Openfire Server settings

Configure Server Settings as mentioned in above screenshot and click on Continue.

Openfire Server Database Settings
Openfire Server Database Settings

We have configured a MariaDB database for our Openfire server. Therefore, choose Standard Database Connection on Database Settings page and click on Continue.

Openfire Server Database Connection
Openfire Server Database Connection

Define Database Connection settings according to above screenshot and click on Continue.

Openfire Profile Settings
Openfire Profile Settings

You are at the Profile Settings page. Accept the default settings and click on Continue.

Openfire Administrator Account
Openfire Administrator Account

Define email address and password for Administrator Account and click on Continue.

Openfire Setup Completed
Openfire Setup Completed

Setup is completed. Click on Login to the admin console to access Openfire web UI.

Openfire Login
Openfire Login

Login as admin user.

Openfire Admin Console
Openfire Admin Console

After successful login, you may reach at the System Information page of Openfire admin console.

Click on Users/Groups to create a new user for accessing Openfire services.

Openfire Server - Create User
Openfire Server – Create User

Create a regular user as we have created in above screenshot.

Openfire Server - User Properties
Openfire Server – User Properties

User ahmer has been created.

The user we have created is enough to demonstrate the client connectivity with Openfire server, therefore, we are not creating more users here. You can create as many users/groups as you like from the same page.

Install Spark IM Client for Windows

We have successfully install Openfire on CentOS 7. Now, we need a client system and software to test our configurations.

Ignite Realtime provides Spark software. It is a free and open-source XMPP client. We will install it on our Microsoft Windows based machine and then use it to connect with our Openfire XMPP server.

Download Spark client from Ignite Realtime website and install it on the MS Windows. We are not going to show the installation process of Spark client, because it is pretty straight forward and you should go on with the default options.

After installation, Run Spark client.

Spark IM Login 1
Spark IM Login 1

We can login using ahmer user, but we have to perform some additional settings before login.

Click on Advanced.

Spark IM Preferences
Spark IM Preferences

We have to configure two settings here:

1.  Set hostname or IP address of Openfire server
2.  Accept all certificates to remove certificate warning at user login.

Click on Ok.

Spark IM Login 2
Spark IM Login 2

Click on Login.

Spark IM
Spark IM

We have successfully login to our Openfire XMPP server on CentOS 7 using Spark IM client.

Final Thoughts

If you found this guide on installing Openfire on CentOS 7 helpful and need additional assistance or a custom setup, feel free to contact me on Fiverr. I offer expert installation and configuration services for Openfire and other software. Visit my Fiverr profile here to learn more and get started with your project today!

One thought on “How to install Openfire on CentOS 7”

Leave a Reply