Nexus Setup
Thanks to the nexus-repository-installer project on the Sonatype Community, the steps to install (and update) Nexus Repository Manager are now greatly simplified.
The old manual steps are archived here for reference: Old Nexus Setup, Old Nexus Daemon
-
Use the latest Java 8 release version of Java available from OpenJDK.
Java runtimes above Java 8 have not been verified - do not use them:
pi@raspberrypi:~ $ java -version java version “1.8.0” Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode)
Notes from the bleeding edge: The 32bit JVM on Pi OS can't access more than 4gb of memory. In order to try accessing more memory, I installed a 64bit version of Pi OS (danger, unstable, run away). Unfortunately, Nexus Repository Manager still requires jdk8 - which is not available by default from the debian buster repos. Below are the hoops I jumped through to get a recognized java 8 installation.
- create file:
/etc/apt/sources.list.d/adoptopenjdk.listwith content:deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ buster main - run the following:
$ sudo apt update $ wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add - $ sudo apt install adoptopenjdk-8-hotspot- run the documented installer steps, and all should be well.
- create file:
-
Follow these Apt Setup steps to add the installer package repository. You can run the last step to install Nexus Repository Manager, but then you should immediately stop the Nexus daemon to allow you to customize the memory settings for the Pi. For example:
AFTER following the steps from “Apt Setup” above, do the following:
Stop the service before changing configuration
sudo service nexus-repository-manager stop
If you run Nexus with the default memory settings, you could run into problems.
A Pi currently only has 1 GB to 8 GB of RAM. If your Pi has less than 8 GB of RAM, you should configure Nexus to use less
RAM than normal, and allocate less direct memory for use by the
database.
Edit the nexusvm.options file:
sudo vi /opt/sonatype/nexus3/bin/nexus.vmoptions
Change:
-Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m
to:
-Xms1200M -Xmx1200M -XX:MaxDirectMemorySize=2G
or for a Pi with less than 4 GB of RAM, use:
-Xms350M -Xmx350M -XX:MaxDirectMemorySize=350M
Additional steps for Nexus versions 3.19 and newer:
Also change:
-Djava.endorsed.dirs=lib/endorsed
to:
-Djava.endorsed.dirs=lib/endorsed:/opt/sonatype/jna
NOTE: Newer versions of Nexus (3.19+) ship with a version of OrientDB which includes a version of jna that accidentally omitted the ARM versions of some native libs.
The solution is to manually download a newer version of jna, via:
sudo mkdir /opt/sonatype/jna
cd /opt/sonatype/jna
sudo wget https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.5.0/jna-5.5.0.jar
sudo wget https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/5.5.0/jna-platform-5.5.0.jar
sudo chmod +x /opt/sonatype/jna/*
Launch nexus.
To see the log output on the console, use this command:
sudo service nexus-repository-manager start
You can 'tail' the nexus log file to watch startup progress using a command like this:
tail -n 500 -f /opt/sonatype/sonatype-work/nexus3/log/nexus.log
Watch for a message like:
-------------------------------------------------
Started Sonatype Nexus OSS 3.15.2-01
-------------------------------------------------
While Nexus is starting, you can monitor the system work load using `top`. Wait for the `java` process to ease up on
the cpu (well below 100% CPU in `top`). Then from your PC, open the link below to Nexus running on the Pi:
http://the-Pi-IP-address:8081
For security reasons, recent versions of Nexus generate a unique admin password during the first startup.
To read the generated admin password for your first login to the web UI, you can use the command below:
cat /opt/sonatype/sonatype-work/nexus3/admin.password && echo
For simplicity, you should check `Enable anonymous access` in the prompts following your first login.
Huzzah! Nexus is running on your Pi.
Next step: Repository Test
