Although major upgrade points are already covered in the official Upgrade Guide (in documentation section), this question pops in the forums from time to time. So i decided to rehash some things from the guide.
First things first - backup your database and Openfire installation! I have lost count on how many times someone says in the forums “i have tried to upgrade and now server won’t start, what should i do?”. When you tell them to restore from backup, they often don’t have a backup. This is a fundamental thing in running any IT services, you MUST have some sort of backup system. It can be at least manually copying some folders once per month. Still better than nothing. In the case of Openfire, it might be enough to stop it (or its service, if it is used) and backup its installation folder. If you are using the embedded (built-in) database, then it should be in the same installation folder, called embedded-db. In case of using external database you should have some standard procedures of backing it up (can’t suggest anything as i haven’t used Openfire with such DB).
Upgrading with the same arch (x86 to x86 or x64 to x64)
If you are not going to switch from x86 to x64, it is simple. Just run the installer, let it detect your current installation and choose to upgrade it. Since 4.1.5 version it even automatically stops and reinstalls and then runs again the service. So, no need to stop it before or reinstall manually. Btw, i’m speaking mostly from the Windows user standpoint. On Linux it may be different.
Changing the arch when upgrading
As x64 version was introduced not so long ago, many Openfire admins still have x86 version running in their networks. It is a natural desire to switch to x64 version to be able to use more RAM with Openfire (although you would still need to manually adjust memory parameters to make it use more memory). Two options are covered in the guide (again, for Windows). It is important to know the difference between Program files and Program files (x86) when doing such upgrade. Also, if you are running x86 version and launch the x64 installer, it won’t automatically detect the old installation and by default would suggest to install into Program files folder. This way you will end up with two Openfire installations. In that case just go to Program files\Openfire (new install) and run uninstall.exe there to get rid of a new installation. Then run the installer again and this time don’t forget to point it to Program files (x86)\Openfire to upgrade.
Some users are running pretty old Openfire installations when they finally decide to upgrade. Although in theory running the latest installer should work. But often it doesn’t, because of numerous changes to Openfire and its database schema during years. So, it is advised not to try to upgrade to the latest version at once. Especially if you are running some ancient versions like 3.7.0 or even 3.9.3, 4.0.0. In that case you may want to do incremental upgrades by downloading all the installers between your and the latest version, installing one by one and checking how the server works after every install, maybe even letting it run for a day or two with every version. You can find all versions on GitHub’s releases page.
Stop using Windows Launcher!
Although service option was introduced probably with very first Openfire versions, many admins still use Openfire by manually running its Launcher on Windows (yellow bulb icon). First, this is a very inefficient way to run a server. You have to be logged in to run it. You can also run into Windows UAC problems, if you install it into Program files and run without the Run as admin option. Service allows you to run Openfire automatically without having to login to the server. It also runs with System permissions and doesn’t have problems with UAC. If you really want to use the launcher, then you must know a few things. New Openfire versions automatically install the service and even will run it, if you won’t uncheck it on the last step of the install process. So, if you try to run the launcher after the upgrade, you will create a conflict. Openfire is already running as a service and has locked the database. You run it with the launcher, which also tries to lock the database and you get lots of Database access errors in the launcher and Openfire might not work properly. So, if you want to use the launcher, go to Windows Services and stop and disable the Openfire service. You will have to do this after every upgrade though. So we encourage you to switch to using service.
If you want to switch to the service, then there is nothing to do. Just don’t run the launcher after the upgrade, remove it’s shortcut, if you had it somewhere close, so you won’t accidentally run it again. You may also want to create another vmoptions file with custom memory parameters. As the one you have created for openfire.exe won’t work for the service. You will have to create openfire-service.vmoptions file for the service. And to access Admin Console just use URL like http://localhost:9090 or https://localhost:9091 (when accessing from a browser on the same server it is installed on).
Switching to another server while upgrading
Usually when one wants to upgrade Openfire, they also want to upgrade the OS it is used on, thus move Openfire to a new server. There is no real difference on how to achieve that. Either upgrade on the old server first and then move/export the database to the new installation on the new server. Or install the same version on the new server, move/export the old database and then upgrade Openfire.