Migrating Openfire Instant Messaging Service
Jive Software’s community software organization Ignite Realtime has some great products available. One of the best is the Openfire, a real time collaboration (instant messaging) server: it’s open source, based on the XMPP (Jabber) transport open standard for easy integration with other tools and clients, is actively developed and widely used. For companies needing an instant messaging solution it has a lot to offer and I install it for quite a few clients.
I recently needed to move an installation using MySQL running on an Ubuntu server to a new PBX in a Flash (CentOS) server. On Debian systems this is a breeze as the package is well maintained in the repositories, but on CentOS it’s a little more involved. Here’s how I did it:
- Openfire isn’t available using yum, so the first step is to download the rpm. You can get it from Ignite Realtime’s downloads page to get the latest version, or use wget to snag openfire-3.7.0-1.i386.rpm. It includes it’s own Java runtime, so you don’t have to worry about dependencies.
Since this was a migration and I didn’t want to do an upgrade and then troubleshoot any possible complications from upgrading and migrating simultaneously, I needed to download an older version. This was much more painful than it needed to be as unfortunately Ignite Realtime doesn’t seem to maintain an online archive for older versions. After some experimentation I figured out the package name and was able to use wget to pull it from the download URL.
- Logging into MySQL on the CentOS server, I created an “openfire” database and then gave access rights to a new user created using the same name and password as the MySQL openfire account on the Ubuntu server.
- On both servers, I stopped the openfire and mysql services.
- Since it was a migration, the configuration information such as the server name was staying the same. I could just copy the Ubuntu server’s /etc/openfire/openfire.xml onto the CentOS server at /opt/openfire/conf/openfire.xml.
- I used tar to copy the Ubuntu server’s /etc/openfire/plugins directory to the CentOS server’s /opt/openfire/plugins directory (keeping the same permissions – don’t forget the -p flag!).
- On CentOS, I had to recursively chown the plugins directory and the openfire.xml for daemon:daemon (on Ubuntu, it’s openfire:openfire).
- I then copied /var/lib/mysql/openfire/ from the Ubuntu server to /var/lib/mysql/openfire/, making sure to keep the permissions when I tarred up the files and after untarring making sure the file ownership was mysql:mysql.
- Since PBX in a Flash uses IPTables as a firewall, that needs to be updated as well. I added
-A INPUT -p tcp -i eth0 –dport 5222 -j ACCEPT
-A INPUT -p udp -i eth0 –dport 5222 -j ACCEPT
-A INPUT -p tcp -i eth0 –dport 7777 -j ACCEPT
-A INPUT -p udp -i eth0 –dport 7777 -j ACCEPTr0
-A INPUT -p tcp -i eth0 –dport 9090 -j ACCEPT
-A INPUT -p udp -i eth0 –dport 9090 -j ACCEPT
-A INPUT -p tcp -i eth0 –dport 9091 -j ACCEPT
-A INPUT -p udp -i eth0 –dport 9091 -j ACCEPT
to /etc/sysconfig/iptables and updated iptables with the following command: iptables-restore < /etc/sysconfig/iptables.
- I started the MySQL and Openfire services up again on the CentOS server, and using Ignite Realtime’s Spark instant messaging client I connected to the server using the IP address. Success!
- Finally I changed over the DNS entries to point at the new CentOS server. Once the change had propagated, I logged in at http://www.mydomain.com:9090 using the original Debian username and password and verified the web console was up and running.
A bit tricky, but not too bad! If you get stuck, there’s lots of info available by searching and you can always try the (unfortunately rather sparse) official Openfire documentation as well.