How to migrate Openfire (Instant Messaging Server) in Linux

I have migrated Openfire to new server yesterday due to server hardware issue. Before proceeding with migration i thought it was difficult to do but after going through the documentation,i came to know that nothing was there to worry to do that. Follow the below steps to migrate Openfire (Instant Messaging Server) in Linux.

What’s Openfire ?

Openfire is a real time collaboration (RTC) server licensed under the Open Source Apache License. It uses the widely adopted open protocol for instant messaging, XMPP (also called Jabber). Openfire is incredibly easy to setup and administer, but offers rock-solid security and performance.

New Server

First install the openfire to new server then move/copy required files/folders from old server. Finally allow the required ports in the firewall.

1) Prerequisites for Openfire

Before proceeding to Openfire installation, check whether java (openjdk) has been installed in your system or not. If no, install it.

[email protected] [~]# java -version
java version "1.7.0_71"
OpenJDK Runtime Environment (rhel-2.5.3.2.el6_6-x86_64 u71-b14)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

2) Download & Install the Openfire package

Use the below link to download the latest Openfire server package, then install it.

# Download the Openfire package #
[email protected] [~]# wget http://download.igniterealtime.org/openfire/openfire-3.9.3-1.i386.rpm

# Install the Openfire package #
[email protected] [~]# rpm -Uvh openfire-3.9.3-1.i386.rpm

# backup openfire.xml file #
[email protected] [~]# mv /opt/openfire/conf/openfire.xml /opt/openfire/conf/openfire.xml.bak

If you used Mysql Database then create it or else leave these steps 
# Create Database #
mysql> create database openfire;
Query OK, 1 row affected (0.00 sec)

# Create Datbase user #
mysql> CREATE USER 'openfire'@'localhost' IDENTIFIED BY 'openfire';
Query OK, 0 rows affected (0.00 sec)

# Assign the PRIVILEGES #
mysql> GRANT ALL PRIVILEGES ON openfire.* TO 'openfire'@'localhost';
Query OK, 0 rows affected (0.00 sec)

# FLUSH PRIVILEGES #
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

Old Server

Stop the openfire service then move/copy required files/folders to new server.

# Stop openfire service #
[email protected] [~]# service openfire stop
or
[email protected] [~]# /etc/init.d/openfire stop

# Copy openfire.xml file (My ssh port no is 22. so, use according that) #
[email protected] [~]# rsync -avz -e "ssh -p 22" /opt/openfire/conf/openfire.xml x.x.x.x(New server IP):/opt/openfire/conf/

# Copy plugins folder #
[email protected] [~]# rsync -avz -e "ssh -p 22" /opt/openfire/plugins/* x.x.x.x(New server IP):/opt/openfire/plugins/

# Copy Embadded-db #
[email protected] [~]# rsync -avz -e "ssh -p 22" /opt/openfire/embedded-db x.x.x.x(New server IP):/opt/openfire

If you use Mysql Database then backup & sync or else leave these steps 
# Database Backup #
[email protected] [~]# mysqldump -u root -p openfire > openfire.sql

# Sync Database Backup to new server #
[email protected] [~]# rsync -avz -e "ssh -p 11021" /root/openfire.sql x.x.x.x(New server IP):/root

New Server

3) Configure openfire in new server

Start the openfire server then configure it.

If you use Mysql Database then backup & sync or else leave this step only 
# Restore Database Backup #
[email protected] [~]# mysql -u root -p openfire < openfire.sql

# Start openfire service #
[email protected] [~]# service openfire start
or
[email protected] [~]# /etc/init.d/openfire start

# Allow required ports in firewall #
[email protected] [~]# 5222, 7777, 9090, 9091

Now, Access the Openfire (From new server) installation url on your browser and configure it, http://localhost:9090 or http://your-ip-address:9090 but i have installed in Remote server and my url is http://chat.2daygeek.com:9090 then configure it.

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...