Openfire: Upgrade Guide

# Upgrade Guide

## Introduction

Upgrading Openfire is almost as easy as installing Openfire from scratch. As part of the upgrade process it is highly recommended to backup your current installation and database. Having backups will let you easily rollback to a previous state and ensure that you have not lost vital information. The rest of the document describes the common steps to perform a successful upgrade.

The new version of Openfire will be installed over the existing version and all settings and data will be retained.

## Standard Upgrade

### Windows EXE

1. Stop Openfire (when using a service, stop it manually).
2. Backup the Openfire installation directory. The default is `C:\Program Files\Openfire`
3. Backup the Openfire database. Note that the embedded database is backed up in step 2.
4. Run the installer for the new version of Openfire (note that the installer MUST point to the base installation directory of the previous version).
5. Complete the installer process.
6. Start Openfire (when using a service, start it manually).

Since 4.1.5 the installer will stop and reinstall the service and then start it again automatically.

### Windows EXE (upgrading from x86 to x64 version)

1. (fastest option) When running the x64 installer point it to the current installation folder of Openfire (by default `C:\Program files (x86)\Openfire`). If you have Openfire service installed (version prior 4.1.5), stop it first. During the installation it will install/reinstall the service and on the last step you will have to choose whether to run it.
2. (safest option) When running the x64 installer point it to a new installation folder (by default `C:\Program Files\Openfire`). If you have Openfire service installed (version prior 4.1.5), stop it first. During the installation it will install/reinstall the service. On the last step check not to start the service. Copy the `/conf`, `/embedded-db` (if using this database), `/plugins`, `/resources/security` from the old installation folder to the new one. Manually start the services via Services control page.

The upgrade guide has been tested against 4.1.4 and newer versions. It should work for older versions, but the results may be different for very old versions. You won't have to stop the service before the upgrade since the version 4.1.5. It will stop and reinstall it automatically.

### RPM - RedHat based Linux systems (RHEL, AlmaLinux, Fedora, Rocky Linux, etc)

1. Stop Openfire.
2. Backup the Openfire installation directory.
3. Backup the Openfire database. Note that the embedded database is backed up in step 2.
4. Install the new RPM. Execute `rpm -Uvf openfire-*.rpm` to update your current install
5. Start Openfire.

Remember that the server can be started in manual or automatic mode. Execute `/opt/openfire/bin/openfire.sh` to start in manual mode (in foreground) or execute `systemctl restart openfire` to start the server as a service (in background). Execute `systemctl stop openfire` to stop the server's service.

#### Things to note

- The new RPM installs Openfire as a service. That means that the server will be started when the OS is started and the server is stopped upon shutdown.
- `/opt/openfire/bin/openfire` no longer exists. It was a start/stop script generated by Install4j. Since we are no longer using Install4j, it needed to go. Instead, we now have a more standard SystemD service, use `systemctl restart` to start it.
- `/etc/sysconfig/openfire` can now be used to 'tweak' things, like paths and such. See the file for more information.
- The entire directory tree is owned by daemon now. We ditched the need for a new user and are sticking with a standard unix system account. The RPM will take care of owning everything as you install it.
- Beyond having `/etc/init.d/openfire` to stop and start openfire, it has chkconfig compatible tags in it and is automatically added via the rpm so that openfire should start up as your server starts up.
- The `/etc/init.d/openfire` should not be used directly but called with a SystemD wrapper via `systemctl` command. The init script is difficult to maintain and eventually it will be replaced with the SystemD unit. See the issue ticket for details
- The RPM will no longer overwrite: `conf/openfire.xml`, `resources/security/keystore` or `resources/security/truststore`.

### Mac OS X DMG

1. Stop Openfire.
2. Backup the Openfire installation directory. The default is `/usr/local/openfire`.
3. Backup the Openfire database. Note that the embedded database is backed up in step 2.
4. Open the installer for the new version of Openfire.
5. Complete the installer process.

### ZIP or TAR.GZ

1. Stop Openfire.
2. Backup the Openfire installation directory. This step is critical because the data will be overwritten with the new .tar.gz/zip install.
3. Backup the Openfire database. Note that the embedded database is inside the installation directory and is backed up in step 2.
4. Wipe out the contents of the Openfire installation directory (all folders and files).
5. Extract the .tar.gz/zip file into the installation directory.
6. Copy the `conf` directory from the backup to the installation directory.
7. Copy the `embedded-db` directory from the backup to the installation directory.
8. Copy the `enterprise` directory from the backup to the installation directory, if it exists.
9. Copy the `plugins` directory from the backup to the installation directory except for _plugins/admin_.
10. Copy modified files located in `resources/security` from the backup to the installation directory.
11. Start Openfire

## Special Upgrade cases

There are some special occasions where some manual intervention is needed while performing the upgrade process. This is usually the case when some mayor refactoring work was done that requires complex upgrade operations. However, this is not a common case in Openfire (e.g. this happened twice since 2003). Below you will find the upgrade steps to follow for these special occasions:

- Wildfire to Openfire Upgrade Guide
- Upgrade guide to Wildfire Enterprise 3.2.0