Easily Set Up an Openfire XMPP Server on Ubuntu | Effortless

Openfire XMPP Server

In this tutorial, we will guide you through the installation process of Openfire XMPP Server on Ubuntu. Openfire is a widely recognized and powerful IM server that utilizes the XMPP/Jabber convention. It stands out among other Presence Servers, making it an ideal choice for Real-Time Collaboration (RTC) purposes.

Install Openfire On Ubuntu Server

One of the leading clients for Openfire is Spark, which was created by the same team. The XMPP also known as Extensible Messaging and Presentation Protocol, is an open protocol for instant messaging that enables real-time communication through XML-based chat. Furthermore, we can leverage the capabilities of Openfire to create an Android chat app similar to Whatsapp using Android Studio. By linking to the Openfire XMPP server, you can effectively utilize it as a user database. Join us in exploring the potential of Openfire for your chat application needs.

Openfire provides the best features from other XMPP servers.

  1. MYSQL, Embedded Database and Oracle for message storage and user details.
  2. Integration With LDAP.
  3. Web Admin Panel.
  4. Support Jingle Node for Audio and Video Calling.
  5. User Status Plugin Which Traces User IP.
  6. Integrate with Android XMPP Clients apps like Conversations Android App, Xabber and A talk.
  7. A lot of plugins.

Install Openfire XMPP Server On Ubuntu

First of all, So, We need to update our Ubuntu server to install Openfire. Therefore open a new window and run the following command.

sudo apt update

sudo apt upgrade 

Install JAVA JDK For Openfire

Once our Ubuntu server packages are updated. To install Openfire in our Ubuntu server , we need to install Java JDK we will run the following command

sudo apt install openjdk-8-jdk

 java -version 

Installing MariaDB With New Version

It’s most important to install MariaDB with the new version because the Openfire database has a long table that can’t upload properly without a new version. So, Please run the following commands to install MariaDB with the latest version.

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

Now add a new file by running this command

sudo nano /etc/apt/sources.list.d/mariadb.list

After opening a new file, Please copy and paste the following lines and save it.

deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main
deb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main

Now, We need to update our Ubuntu server with the following command.

sudo apt update

Once our Ubuntu server is updated, We will install MariaDB with running the following command.

sudo apt install mariadb-server

sudo systemctl status mariadb

 sudo systemctl stop mariadb.service      # To Stop MariaDB service 
 sudo systemctl start mariadb.service     # To Start MariaDB service 
 sudo systemctl status mariadb.service    # To Check MariaDB service status 
 sudo systemctl restart mariadb.service

Download & Install Openfire XMPP Server On Ubuntu

We will download Openfire from the official website. So please visit and copy the new version download link and paste here

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

Once Openfire is downloaded then we will run the following command to install.

sudo  dpkg -i openfire.deb 

systemctl status openfire   #check status 

● openfire.service - LSB: Start/stop openfire jabber server
 Loaded: loaded (/etc/init.d/openfire; generated)
 Active: active (running) since Tue 2020-01-26 12:00:06 UTC; 9min ago
 Docs: man:systemd-sysv-generator(8)
 Tasks: 22 (limit: 1153)
 CGroup: /system.slice/openfire.service

Create a Database to install the Openfire XMPP Server

So, We will create a database for the Openfire server by running the following commands.

mysql -u root -p
 
Enter password. 


 create database openfire; 

 GRANT ALL PRIVILEGES ON openfire.* TO openfire@localhost IDENTIFIED BY 'password123!'; 

 flush privileges; 

  exit 

So, After creating a database and user. Now, we will import the Openfire database schema by running the following command

 mysql -u root -p

 Enter password:  

 use openfire; 

 source /usr/share/openfire/resources/database/openfire_mysql.sql; 

 show tables; 

exit;

Firewall To Access Openfire

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

sudo ufw disable     // you can also stop firewall 

To open admin panel, So please visit HTTP://<server-ip|domain>:9090

 Easily Set Up an Openfire XMPP Server on Ubuntu: A Step-by-Step Guide

In addition, the server setting page gives the same domain URL. Secondly, database Settings is Given Below and also shown in the screenshot.

1. Database Driver Presets:MySQL
2. JDBC Driver Class: com.mysql.jdbc.Driver
2. Database URL:jdbc:mysql://127.0.0.1/openfire?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8
4.Username: openfire
5. Password: password123!

After filling, in the information. So, please hit the Continue button and you will see a Profile Settings page and Default option. Finally, you will see the admin user, email address and password. Set your new password for the admin user name. Now you can log in with the following details. After finishing installing Openfire, now you can set up your android chat app. Please check out our article How to make android chat app using android studio

username: admin

password: your new given password