Upgrading Horizon 23 to 24 on CentOS 7 and switch to OpenJDK 11

I have installed OpenNMS Horizon 23.0.4 on a CentOS 7, created a user added a node and set an SNMP community. I use this setup to describe what happens when you try to upgrade to the latest Horizon 24 version. Horizon 23.0.4 is running and is the instance to be updated.

As always before making an upgrade in production, make backups. Before you update check the Breaking Changes section and how your installation might be affected.

Before upgrading you can check which files you have modified from a pristine install by following the instructions here: How to figure out which configurations are changed from a pristine install.

Step 1: Stop Horizon

systemctl stop opennms

Step 2: Enable the OpenNMS repository to get updates

yum-config-manager --enable opennms-repo-stable-common,opennms-repo-stable-rhel7

Step 3: Update the packages

yum update

Step 4: Install OpenJDK 11 development kit

yum install java-11-openjdk-devel.x86_64

Step 5: Set OpenJDK 11 as default Java

update-alternatives --config java

Step 6: Use OpenJDK 11 with your opennms

cd /opt/opennms/bin
./runjava -s

Verify the output, should look like this:

runjava: Looking for an appropriate JVM...
runjava: Checking for an appropriate JVM in JAVA_HOME...
runjava: Skipping... JAVA_HOME not set.
runjava: Checking JVM in the PATH: "/etc/alternatives/java"...
runjava: Did not find an appropriate JVM in the PATH: "/etc/alternatives/java"
runjava: Searching for a good JVM...
runjava: Found a good JVM in "/usr/lib/jvm/java-11-openjdk-11.0.3.7-0.el7_6.x86_64/bin/java".
runjava: Value of "/usr/lib/jvm/java-11-openjdk-11.0.3.7-0.el7_6.x86_64/bin/java" stored in configuration file.

Step 7: Migrate your configuration files

cd /opt/opennms/etc
find . -iname "*.rpmnew"

The files with .rpmnew come from Horizon 24 and need to be merged. If you haven’t changed these files, you can use the .rpmnew files by overwriting them.

Here is a sample output:

./config.properties.rpmnew
./jmx.acl.org.apache.karaf.bundle.cfg.rpmnew
./jmx.acl.org.apache.karaf.config.cfg.rpmnew
./org.apache.karaf.command.acl.feature.cfg.rpmnew
./org.apache.karaf.command.acl.jaas.cfg.rpmnew
./org.apache.karaf.command.acl.kar.cfg.rpmnew
./org.apache.karaf.command.acl.system.cfg.rpmnew
./org.opennms.features.topology.app.icons.application.cfg.rpmnew
./org.opennms.features.topology.app.icons.bsm.cfg.rpmnew
./service-configuration.xml.rpmnew

If you use external authentication like LDAP or RADIUS check if the files in /opt/opennms/jetty-webapps/opennms/WEB-INF/spring-security.d are still enabled. On major version updates it might be required to merge your changes with the sample configuration files.

:biohazard: If you skip this step and step 8 and you just try to start opennms you get the following error message in your systemd journal:

journalctl -u opennms
-- Logs begin at Mon 2019-03-25 04:48:07 EDT, end at Tue 2019-04-30 08:48:56 EDT. --
Apr 30 08:27:50 localhost.localdomain systemd[1]: Starting OpenNMS server...
Apr 30 08:27:56 localhost.localdomain opennms[45072]: Starting OpenNMS: (not waiting for startup) [  OK  ]
Apr 30 08:27:56 localhost.localdomain systemd[1]: Started OpenNMS server.
Apr 30 08:34:12 localhost.localdomain systemd[1]: Stopping OpenNMS server...
Apr 30 08:34:38 localhost.localdomain opennms[47264]: Stopping OpenNMS: [  OK  ]
Apr 30 08:34:40 localhost.localdomain systemd[1]: Stopped OpenNMS server.
Apr 30 08:48:56 localhost.localdomain systemd[1]: Starting OpenNMS server...
Apr 30 08:48:56 localhost.localdomain opennms[48040]: /opt/opennms/bin/opennms: OpenNMS not configured.
Apr 30 08:48:56 localhost.localdomain opennms[48040]: /opt/opennms/etc/configured does not exist.
Apr 30 08:48:56 localhost.localdomain opennms[48040]: You need to run the installer to set up the database.  In most
Apr 30 08:48:56 localhost.localdomain opennms[48040]: cases, it is enough to run:
Apr 30 08:48:56 localhost.localdomain opennms[48040]: /opt/opennms/bin/install -dis
Apr 30 08:48:56 localhost.localdomain opennms[48040]: For details, see the install guide at:
Apr 30 08:48:56 localhost.localdomain opennms[48040]: http://www.opennms.org/index.php/QuickStart#Initialize_OpenNMS_and_the_Datab
Apr 30 08:48:56 localhost.localdomain systemd[1]: opennms.service: control process exited, code=exited status=6
Apr 30 08:48:56 localhost.localdomain systemd[1]: Failed to start OpenNMS server.
Apr 30 08:48:56 localhost.localdomain systemd[1]: Unit opennms.service entered failed state.
Apr 30 08:48:56 localhost.localdomain systemd[1]: opennms.service failed.

Step 8: Migrate database schema

cd /opt/opennms/bin
./install -dis

:information_source: This step can take a serious amount of time depending on how big your database is.

Step 9: Disable automatic updates and start OpenNMS Horizon

yum-config-manager --disable opennms-repo-stable-common,opennms-repo-stable-rhel7
systemctl start opennms

My one concern with this setup is that it’ll break your OpenNMS install the next time you upgrade OpenJDK. May be better to configure it to use /usr/lib/jvm/java-11-openjdk/bin/java instead?

1 Like

You can fix it, it’s a wiki post.

I have written a little bit more in detail in Dealing with Java Environments on CentOS and Ubuntu related to your point about updating OpenJDK.