## 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:](https://mermaid.live/edit#pako:eNpdkEtPhDAUhf_KTdeD0TFRh8UkAvPYqAvHjZRFpZehCbSkDx8B_rulopmxq957vp5z0p6UiiOJSRRFVB6EbTCGR_x0Blx31IwjdFqVaAyVAaka9VHWTFs4ZFSCP_f5OW-sVwuIojUkfeq0RmnhHbURSo4_T5JJHa4vbu5AaVANRz1Amr_MDlaB11bFP3g1QHbO3F7OTBri5kJZGDZ9xix7Ywbn0E3wedJi6pMlA2zzB-HNLEIgTTDdL4tTfL8cYHcaup5ir2ZmG5J2ZEFa1C0T3H9kP0mU2BpbpCT2V44Vc42lhMrRo8xZ9fwlSxJb7XBBXMd9h0wwn9GSuGKN8Vut3LH-mzomX5X6VcdvraaJPw) ```mermaid --- 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 ``` 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](https://help.sonatype.com/en/migrating-to-a-new-database.html) 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: ```bash java -Xmx6G -Xms6G -XX:+UseG1GC -XX:MaxDirectMemorySize=28672M -jar nexus-db-migrator-3.70.2-01.jar --migration_type=h2 ``` 6. move `nexus.mv.db` file to your `$data-dir/db` directory 7. Edit the $data-dir/etc/nexus.properties file and add the following line: ``` nexus.datastore.enabled=true ``` 8. 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: ```bash 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/" ```