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.
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.
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.
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).
vi /etc/postgresql/17/main/postgresql.conf
a. Search for “autovacuum = on“ and uncomment it
b. Save and close (escape, :x, enter)
systemctl restart postgresql
systemctl status postgresql # To test
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;
quit
cd /opt/nexus-data/etc/fabric # YOUR DATA PATH MAY BE DIFFERENT
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
Save and close (escape, :x, enter)
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)
Update Service Dependency
NOTE: This is probably different for your setup, but we run nexus as a service as follows
NOTE: This update ensures PostgreSQL loads up on bootup before Nexus does
sudo su
vi /etc/systemd/system/nexus.service
a. At the bottom of the [Unit] section, add a new Requires and After. The full file should look like this
b. [Unit]
Description=nexus service
After=network.target
Requires=postgresql.service
After=postgresql.service
[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
User=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target
c. systemctl daemon-reload
Test And Start
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’ # NOTE: This runs as user nexus
d. Once you see the big logo, similar to as follows, try going to <your_nexus_server_url> in your browser
e. “-------------------------------------------------”
“Started Sonatype Nexus PRO 3.77.1-01”
“-------------------------------------------------”
f. If you’re satisfied with testing, hit ctrl+c ONLY ONE TIME, and wait for proper shutdown (will take a few seconds).
systemctl start nexus
#Wait a moment then check your browser
# IMPORTANT: ENSURE REBOOTING WORKS
reboot
#Try not to ssh into or mess with the server. Just wait a few minutes and let it do its thing, then check Nexus in your browser.
Hi there! Sonatype Tech Writing Manager here.
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.
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?
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.