Openfire is a cross-platform instant messaging server written in java. It is easy to install and setup. It is available as a free download by Ignite Realtime website.
Openfire requires Java Runtime environment to run. If you want to install Openfire on RPM-based systems then you don’t need to install Java as the Openfire installer for their distribution already includes a JRE.
You will need to install Java on your Debian-based system before running Openfire server.
In this guide, we will install Openfire on CentOS 7. We will also install some plugins and set Java memory limit for our server. 🙂
About this guide:
- Download and Install Openfire on CentOS 7.
- Setup Openfire server.
- Install Zapcat Plugin in Openfire.
- Increase Java memory limit for Openfire server.
Install Openfire on CentOS 7.
Set the Hostname for your server. I am using chat.engytech.in
shell> hostnamectl set-hostname chat.engytech.in
Restart systemd-hostnamed service.
shell> systemctl restart systemd-hostnamed
Edit /etc/hosts file and add the following line in the file.
shell> vi /etc/hosts 127.0.0.1 chat.engytech.in
Update your server.
shell> yum update.
Download and Install Openfire 4.2.3 server.
Download the latest version of Openfire 4.2.3 on CentOS 7.
shell> wget http://download.igniterealtime.org/openfire/openfire-4.2.3-1.x86_64.rpm
Install Important libraries required by Openfire.
shell> yum install -y glibc.i686
Install OpenFire on CentOS 7.
shell> yum install openfire-4.2.3-1.x86_64.rpm -y
Authentication policy for Openfire.
Configure PAM Authentication policy for OpenFire. we will replicate “system-auth” policy for Openfire service.
shell> cp -Rp /etc/pam.d/system-auth /etc/pam.d/openfire
Set Root as Process User for OpenFire.
shell> vi /etc/sysconfig/openfire # OPENFIRE_USER="daemon" OPENFIRE_USER="root"
Also, configure logging for OpenFire. By default OpenFire logs everything in /opt/openfire/logs directory.
Make log directory if not already present on server.
shell> mkdir -p /var/log/openfire/logs
To view Real time logging of OpenFire service, use the following command.
shell> journalctl -u openfire -f -a -n 0
Enable Openfire Service at Reboot.
shell> systemctl enable openfire
Start OpenFire Service.
shell> systemctl start openfire
Check the status of OpenFire service.
shell> systemctl status openfire
Check the Ports used by OpenFire.
[[email protected] ~]# netstat -tulpn Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 21826/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1075/master tcp6 0 0 :::22 :::* LISTEN 21826/sshd tcp6 0 0 ::1:25 :::* LISTEN 1075/master tcp6 0 0 :::9090 :::* LISTEN 10686/java
Setup database and user for Openfire.
Install Latest MariaDB 10.3.10
We will install Latest MariaDB server by creating a repo file in /etc/yum.repos.d directory. Then enable that repo. for MariaDB.
shell> cat <<EOF>> /etc/yum.repos.d/MariaDB.repo [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.3/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF
Update your server.
shell> yum update.
Install Latest MariaDB 10.3.10.
shell> yum -y install MariaDB-server MariaDB-client
Check the MariaDB server version.
shell> mysql -V mysql Ver 15.1 Distrib 10.3.10-MariaDB, for Linux (x86_64) using readline 5.1
Start the MariaDB server.
shell> systemctl enable mariadb
Enable the MariaDB server at Reboot.
shell> systemctl start mariadb
Check the status of MariaDB server.
shell> systemctl status mariadb
Secure the MariaDB server.
Create a User and Database for OpenFire server.
shell> mysql -uroot -p MariaDB [(none)]> create database fired; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all privileges on fired.* to [email protected] identified by 'cool_fired'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> quit Bye
Now we have created a database and user for our Openfire server. We can now start configuring Openfire server by visiting the Installation page of Openfire.
Login to your Openfire XMPP server.
Setup Openfire server
Select a Language to use with your OpenFire XMPP server.
Openfire server will detect your system hostname. Enter the Domain name you want to use with your Openfire server. Select Property Encryption via AES.
Select the database Type. Select Standard Database connection if you want to use an external database for openfire.
If you want to use inbuilt/Embedded database of Openfire server then select the Embedded Database option.
If you want to use an external database, which we are in this tutorial, then select MySQL option in Database Driver Presets.
Now Edit Database URL field.
By default the value will be:
Our database-name is fired and host-name will be 127.0.0.1.
The end result will be something like this.
Next, The Username will be the user/owner of the database, which is cool in our example :).
Next, Enter the Password of user cool. In this example it is cool_fired.
Also you can select the Minimum Connections, Maximum Connections, Connection Timeout according to the server resources and capacity.
Choose Default in your Profile settings.
Finally, enter your Admin email address and a new strong Openfire admin Password to finish the setup.
Click on Login to the Openfire admin console to Access your Login console.
Finally, Enter your Username which is admin by default and the Openfire admin password to login to your Openfire XMPP server.
Install plugins in Openfire.
Also You can install plugins like Zapcat in Openfire XMPP server.
- First Download Zapcat plugin for Openfire from Sourceforge.
- Extract the Zapcat plugin from the zip file.
- File with name zapcat-openfire-x.x.jar is the important one.
Go to the Administration console of you Openfire server. Also Click on the “Plugins” tab > Choose File > Select the file and then click Upload Plugin.
Once installed you can see the new plugin in the Plugins list.
Increase Java memory in Openfire.
Edit /etc/sysconfig/openfire file and add these lines at the end of the file.
shell> vi /etc/sysconfig/openfire ..... ..... # Increase Java memory in Openfire server. OPENFIRE_OPTS="-Xms256m -Xmx2048m"
Now we have a working Openfire XMPP server. Thanks for visiting this page. Good day. 🙂