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.

root@2daygeek [~]# 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 #
root@2daygeek [~]# wget http://download.igniterealtime.org/openfire/openfire-3.9.3-1.i386.rpm

# Install the Openfire package #
root@2daygeek [~]# rpm -Uvh openfire-3.9.3-1.i386.rpm

# backup openfire.xml file #
root@2daygeek [~]# 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 #
root@2daygeek [~]# service openfire stop
or
root@2daygeek [~]# /etc/init.d/openfire stop

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

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

# Copy Embadded-db #
root@2daygeek [~]# 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 #
root@2daygeek [~]# mysqldump -u root -p openfire > openfire.sql

# Sync Database Backup to new server #
root@2daygeek [~]# 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 #
root@2daygeek [~]# mysql -u root -p openfire < openfire.sql

# Start openfire service #
root@2daygeek [~]# service openfire start
or
root@2daygeek [~]# /etc/init.d/openfire start

# Allow required ports in firewall #
root@2daygeek [~]# 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.

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

2 Comments on “How to migrate Openfire (Instant Messaging Server) in Linux”

  1. Hello Magesh Maruthamuthu ,

    What are these IP ?
    192.168.0.137 = old_server or new_server ?
    83.170.117.116 = old_server or new_server ?

    Thanks

    Cyril

Leave a Reply to Ramya Nuvvula Cancel reply

Your email address will not be published. Required fields are marked *