Welcome to our guide on How to Install Openfire XMPP chat server on Ubuntu 22.04|20.04|18.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 XMPP on Ubuntu 22.04|20.04|18.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 system are up to date:
sudo apt update sudo 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:
$ sudo apt install default-jdk $ java -version openjdk 11.0.13 2021-10-19 OpenJDK Runtime Environment (build 11.0.13+8-Ubuntu-0ubuntu1) OpenJDK 64-Bit Server VM (build 11.0.13+8-Ubuntu-0ubuntu1, mixed mode, sharing)
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 a database and user 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
wget https://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_4.6.7_all.deb -O openfire.deb
Let’s now install it:
sudo apt install -f ./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: Starting LSB: Start/stop openfire jabber server... Jun 26 12:00:06 haproxy-01 openfire: best java alternative in: /usr/lib/jvm/java-8-openjdk-amd64/jre Jun 26 12:00:06 haproxy-01 openfire: Starting openfire: openfire. Jun 26 12:00:06 haproxy-01 systemd: Started LSB: Start/stop openfire jabber server.
Import Openfire database schema:
$ sudo 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 18.04 system runs ufw:
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:
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
- Integrate Openfire XMPP Chat Server with Asterisk PBX server