Support for other Data Bases other then H2 or PostGreSQL - Sonatype Nexus Repository - Sonatype Community

Support for other Data Bases other then H2 or PostGreSQL

post by Ronen_Bar on Feb 24, 2025

Hi all,

Is there a plan to support other databases besides H2 or PostgreSQL? We are planning to migrate to the Pro version, but we have no DBA know-how on PostgreSQL, and it seems our current H2 database isn’t sufficient to handle our volume. Support for Oracle or MS SQL would be great.

post by Joshua_Temple on Feb 25, 2025

If you guys are willing to give PostgreSQL a shot, it may be worth it in the end for portability reasons. I’ve worked with both windows servers and linux servers, and quite a few different types of databases. Migrating with MS SQL is quite a bit of headache, whereas postgresql is a few commands to install, works anywhere, and migrates easily and quickly.

Also, I feel your sentiments about getting it setup because, imo, the Sonatype documentation is kinda lacking. It took us about a bit over an hour to get PostgreSQL setup, only because the Sonatype docs had a lot of implied assumptions that led to more needed research.

If you like though, I can grab my notes and send em your way.

post by Ronen_Bar on Feb 26, 2025

The reason I asked about Oracle or MS SQL is due to maintenance reasons, as I’m not sure how we can handle patches and security fixes as soon as they are available. I would appreciate getting your notes. It would help us while migrating from the current H2 to PostgreSQL.

post by Joshua_Temple on Feb 26, 2025

Here’s how we upgraded from H2 to PostgreSQL

Official documentation: Migrating to a New Database

When you see my instructions, you’ll see why I’m not particularly thrilled about the official documentation. There’s a lot you have to figure out yourself. I hope Sonatype works on a documentation style of more examples and hyperlinks. But anywho…

NOTE: Make sure your PostgreSQL version is OK for your Nexus version. For the latest Nexus 3.77, it says 13+ I think, so I went straight to PostgreSQL 17, and it’s been OK so far (used for 2 weeks no issues).

Install PostgreSQL

  1. ssh @
  2. sudo su
  3. apt update
  4. sudo sh -c 'echo "deb [http://apt.postgresql.org/pub/repos/apt] $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
  5. curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
  6. apt update
  7. apt install postgresql-17 -y
  8. systemctl start postgresql
  9. systemctl enable postgresql
  10. systemctl status postgresql # To test
  11. ufw allow 5432/tcp # Only needed if you have uncomplicated firewall turned on (which it is by default)

Set PostgreSQL Password

  1. sudo -u postgres psql
  2. ALTER USER postgres PASSWORD 'VeryStronGPassWord@1137';

Install Trigram Module

  1. sudo -u postgres psql
  2. create extension pg_trgm schema public;
  3. select * from pg_extension;
  4. quit # Leave PostgreSQL

Migrate Database

  1. sudo su
  2. vi /etc/postgresql/17/main/postgresql.conf a. Search for "autovacuum = on" and uncomment it b. Save and close (escape, :x, enter)
  3. systemctl restart postgresql
  4. systemctl status postgresql # To test
  5. sudo -u postgres psql a. CREATE USER nexus WITH PASSWORD 'super_strong_password_123'; b. # Save password somewhere for your IT admins c. CREATE DATABASE "nexus" WITH OWNER "nexus" ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' TEMPLATE template0;
  6. quit
  7. cd /opt/nexus-data/etc/fabric # YOUR DATA PATH MAY BE DIFFERENT
  8. cp nexus-store.properties nexus-store.properties.orig
  9. vi /opt/nexus-data/etc/fabric/nexus-store.properties a. Comment out the one line already there b. Add these lines to the bottom c. username=nexus password=super_strong_password_123 jdbcUrl=jdbc:postgresql://localhost:5432/nexus advanced=maximumPoolSize=200
  10. Save and close (escape, :x, enter)
  11. vi /opt/nexus-data/etc/nexus.properties a. Add this to the bottom b. nexus.datastore.enabled=true c. Save and close (escape, :x, enter)
  12. Create a backup if you feel like it
  13. cd /opt/nexus-data/db
  14. systemctl stop nexus
  15. #Download latest migrator from Download
  16. chown nexus:nexus nexus-db-migrator*
  17. #Run the following command
  18. java -Xmx4G -Xms4G -XX:+UseG1GC -XX:MaxDirectMemorySize=28672M -jar nexus-db-migrator-*.jar --migration_type=h2_to_postgres --db_url="jdbc:postgresql://localhost:5432/nexus?user=nexus&password=super_strong_password_123"
  19. y at the prompt
  20. sudo -u nexus psql
  21. VACUUM(FULL, ANALYZE, VERBOSE);
  22. quit

Update Service Dependency

  1. sudo su
  2. vi /etc/systemd/system/nexus.service At the bottom of the [Unit] section, add a new Requires and After.
  3. systemctl daemon-reload

Test And Start

  1. If you’re nervous, do this first to start the server in the foreground and see any errors a. sudo su b. cd /opt/nexus/bin c. sudo -H -u nexus bash -c './nexus run' d. Once you see the big logo, check your nexus server url.
  2. systemctl start nexus
  3. reboot

post by Lisa Durant on Feb 26, 2025

Thank you for this feedback and your detailed instructions on how you managed your migration. My team will review your process and see if there is anything we might do to improve our official documentation.

post by Ronen_Bar on Feb 27, 2025

Hi @Joshua_Temple,

Many thanks for the detailed instructions. What I’m missing is understanding the flow. Your Nexus was already running on PRO 3.77.1-01 with H2, right? Based on that, was the migration done, or did you combine the migration with a Nexus upgrade somehow?

post by Joshua_Temple on Feb 27, 2025

Correct. To change to Pro, I reached out to Sonatype asking for a trial license, and in the web UI, uploaded the license file they sent me. That was enough to switch to Pro. Once I was on Pro with H2, the web UI was giving me some warnings about limits and suggesting I switch to PostgreSQL, which is the only reason we bothered.