Skip to content

Instantly share code, notes, and snippets.

@Aref-Riant
Last active April 29, 2025 12:46
Show Gist options
  • Save Aref-Riant/a6f7348f52284bafc9f3b8b5592dc907 to your computer and use it in GitHub Desktop.
Save Aref-Riant/a6f7348f52284bafc9f3b8b5592dc907 to your computer and use it in GitHub Desktop.
Upgrading Sonatype Nexus to 3.72 and higher

Upgrading Sonatype Nexus to 3.72 and higher

Database migration

Nexus 3.71 Only supports H2 Databases, while older versions used OrientDB, Nexus 3.70 supports both H2, and Oriendb so you need to first upgrade to 3.70, because of schema problems, if you are versions older than 3.69, you need to first upgrade into 3.69.

Mermaid Flowchart:

---
Title: Nexus upgrade process
---
flowchart TD
    A[Nexus upgrade start] --> B{Current version}
    B -->|3.68 or older| C[Upgrade to 3.69]
    B -->|3.69| D[Upgrade to 3.70]
    C --> D
    D --> E{Database}
    E -->|Orient DB| F[Migrate Databse to H2]
    E -->|H2| G[Upgrade to > 3.71]
    F --> G
Loading

To migrate database from OrientDB to H2, you need to first upgrade into version 3.70 then, you can follow official docs to migrate your database: docs

  1. Download migrator tool: https://help.sonatype.com/en/orientdb-downloads.html
    or
    wget https://download.sonatype.com/nexus/nxrm3-migrator/nexus-db-migrator-3.70.2-01.jar

  2. Export a backup from Nexus UI -> tasks

  3. stop nexus

  4. place migrator tool in backp path

  5. run Migration tool:

java -Xmx6G -Xms6G -XX:+UseG1GC -XX:MaxDirectMemorySize=28672M -jar nexus-db-migrator-3.70.2-01.jar --migration_type=h2
  1. move nexus.mv.db file to your $data-dir/db directory

  2. Edit the $data-dir/etc/nexus.properties file and add the following line:

nexus.datastore.enabled=true
  1. start nexus

You dont really need to set Xmx to 16G, for a normal database, 4G is also enough.

Upgrading nexus

to upgrade a nexus instance, after downloading and extracting latest version of nexus from: https://help.sonatype.com/en/download.html first you need to compare important config files and apply needed changes. also you need t copy your keystore:

vimdiff nexus-3.70.2-01/bin/nexus.vmoptions nexus-3.72.0-04/bin/nexus.vmoptions
vimdiff nexus-3.70.2-01/etc/jetty/jetty-https.xml nexus-3.72.0-04/etc/jetty/jetty-https.xml
vimdiff nexus-3.70.2-01/etc/jetty/jetty.xml nexus-3.72.0-04/etc/jetty/jetty.xml
vimdiff nexus-3.70.2-01/etc/jetty/nexus-web.xml nexus-3.72.0-04/etc/jetty/nexus-web.xml
vimdiff nexus-3.70.2-01/etc/karaf/config.properties nexus-3.72.0-04/etc/karaf/config.properties
vimdiff nexus-3.70.2-01/etc/nexus-default.properties nexus-3.72.0-04/etc/nexus-default.properties
cp      nexus-3.70.2-01/etc/ssl/keystore.jks nexus-3.72.0-04/etc/ssl/keystore.jks

Java Versions:

Versions after 3.70 need java 17, install java 17 on ubuntu:

sudo apt install openjdk-17-jdk

and you can change active java version by:

sudo update-alternatives --config java
sudo update-alternatives --config javac

Also if you have set java home in your systemd unit file:

vim /etc/systemd/system/nexus.service

Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment