In this tutorial, you’ll learn that how to install Openfire XMPP Chat Server on Ubuntu 20.04. In previous article, we cover the installation of Ejabberd XMPP Server on Ubuntu 20.04. If you missed the guide you can visit the below link to read it.
How To Install Ejabberd XMPP Server On Ubutnu 20.04
Some important features of Openfire.
Some important features of Ejabberd XMPP Server are given below:
- DAP integration support
- MySQL, Oracle, PostgreSQL and embedded database support for user details and massages storage.
- Support both TLS and SSL for security
- A lot of plugins to extend its functionality
- Web GUI configuration manager
- Spark IM client integration
- Clustering to avoid a single point of failure
Follow the below steps for an easy and optimal installation.
Step 1: Update Your System
As it is good practice to have the latest updates installed before installing any package on Ubuntu 20.04, so update the system.
sudo apt update && sudo apt upgrade
Reboot your system to take effects of the changes.
sudo systemctl reboot
Step 2: Install Openfire XMPP Server On Ubuntu 20.04.
Visit the link to download the Openfire latest package.
You can also fetch it with wget package. At the time of this article latest version is 4.5.2.
wget https://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_4.5.2_all.deb -O openfire.deb
After downloading the package, install it with the help of APT package manager.
sudo apt install ./openfire.deb
Press “Y” if prompted to continue the installation.
sabir@Ubuntu20:~$ sudo apt install ./openfire.deb Reading package lists… Done Building dependency tree Reading state information… Done Note, selecting 'openfire' instead of './openfire.deb' The following NEW packages will be installed: openfire 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/39.1 MB of archives. After this operation, 45.8 MB of additional disk space will be used. Get:1 /home/sabir/openfire.deb openfire all 4.5.2 [39.1 MB] Selecting previously unselected package openfire. (Reading database … 200419 files and directories currently installed.) Preparing to unpack /home/sabir/openfire.deb … Unpacking openfire (4.5.2) … Setting up openfire (4.5.2) … adduser: Warning: The home directory `/var/lib/openfire' does not belong to the user you are currently creating. Processing triggers for systemd (245.4-4ubuntu3.2) …
Start & Enable the Openfire services.
sabir@Ubuntu20:~$ sudo systemctl enable --now openfire openfire.service is not a native service, redirecting to systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable openfire
Verify the status of the services.
sabir@Ubuntu20:~$ sudo systemctl status openfire ● openfire.service - LSB: Start/stop openfire jabber server Loaded: loaded (/etc/init.d/openfire; generated) Active: active (running) since Fri 2020-08-07 19:18:19 PKT; 3min 6s ago Docs: man:systemd-sysv-generator(8) Tasks: 28 (limit: 4623) Memory: 212.0M CGroup: /system.slice/openfire.service └─6295 /bin/java -server -DopenfireHome=/usr/share/openfire -Dlog> اگست 07 19:18:19 Ubuntu20 systemd[1]: Starting LSB: Start/stop openfire jabber> اگست 07 19:18:19 Ubuntu20 openfire[6287]: best java alternative in: اگست 07 19:18:19 Ubuntu20 openfire[6287]: Starting openfire: openfire. اگست 07 19:18:19 Ubuntu20 systemd[1]: Started LSB: Start/stop openfire jabber > lines 1-13/13 (END)
Step 3: Configure Database Support For Openfire XMPP Server
In this article I’m going to use MariaDB to store the message data. You can install it by the below command.
sudo apt update
sudo apt -y install mariadb-server
After the installation, create a new database for openfire.
sabir@Ubuntu20:~$ sudo mysql -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 71 Server version: 10.3.22-MariaDB-1ubuntu1 Ubuntu 20.04 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.000 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON openfire.* TO openfire@localhost IDENTIFIED BY 'Your_Password'; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> QUIT Bye
And then import the Openfire database schema by
mysql -u openfire -p'Your_Password' USE openfire; source /usr/share/openfire/resources/database/openfire_mysql.sql;
Verify by listing the tables in the database as shown below:
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.001 sec)
Step 4: Configure Firewall & Access Openfire UI
Allow the firewall access.
sabir@Ubuntu20:~$ for i in 9090 9091 5222 7777; do sudo ufw allow $i; done Rules updated Rules updated (v6) Rules updated Rules updated (v6) Rules updated Rules updated (v6) Rules updated Rules updated (v6)
Now go to your favorite browser and type your IP:9090 to access the Openfire Web Dashboard. On the welcome page choose your language and click on the continue button.
On the next page provide your Server details like hostname or domain name ports, encryption type etc and click on the “Continue” button.
Now, set up the database, select the Standard Database option. You can also select the Embedded Database if you don’t want the MySQL database. So, I’m going to use the standard one simply select it and hit “Continue” button.
Provide the following details for MySQL, you can also use other databases. Replace with your details like domain or IP address.
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: Your_Password
After it press “Continue” and select the default options on the Profile tab.
Finally provide the admin account details.
And then click on the “Login to the admin console” button.
Now, provide the admin account credentials to login to the dashboard.
Finally you are at the openfire dashboard go and explore the amazing services.
So, this is how you can install Openfire XMPP Chat Server On Ubuntu 20.04. Go and explore the different tabs and enjoy the Openfire Server.
Please share this post and join our Telegram Channel.