Sunday, May 25, 2014

Installing Sonatype Nexus repository management

Sonatype nexus is available in open-source version as well as profession version. For our purposes, we will try the OSS version

First download the latest version from Sonatype download directory into /usr/local folder

**************
$ wget http://www.sonatype.org/downloads/nexus-latest-bundle.tar.gz
--2014-05-25 20:11:58--  http://www.sonatype.org/downloads/nexus-latest-bundle.tar.gz
Resolving www.sonatype.org... 207.223.241.84
Connecting to www.sonatype.org|207.223.241.84|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://download.sonatype.com/nexus/oss/nexus-latest-bundle.tar.gz [following]
--2014-05-25 20:11:58--  http://download.sonatype.com/nexus/oss/nexus-latest-bundle.tar.gz
Resolving download.sonatype.com... 199.27.76.192, 199.27.78.192
Connecting to download.sonatype.com|199.27.76.192|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://download.sonatype.com/nexus/oss/nexus-2.8.0-05-bundle.tar.gz [following]
--2014-05-25 20:11:58--  http://download.sonatype.com/nexus/oss/nexus-2.8.0-05-bundle.tar.gz
Reusing existing connection to download.sonatype.com:80.
HTTP request sent, awaiting response... 200 OK
Length: 45566492 (43M) [application/octet-stream]
Saving to: “nexus-latest-bundle.tar.gz.1”

100%[======================================>] 45,566,492  60.8M/s   in 0.7s

2014-05-25 20:11:59 (60.8 MB/s) - “nexus-latest-bundle.tar.gz.1” saved [45566492/45566492]

**************

Next uncompress and untar the application in a folder of your choice, e.g., /usr/local/share/applications and copy "sonatype-work" folder into the root nexus folder. Navigate to $NEXUS_HOME/bin folder and start the application using "./nexus start". To confirm that the process started you can check
  • $ps -ef |grep nexus (to check if process is running in the process list)
  • $netstat -an |grep 8081 (to check if default connector port for nexus is in LISTENING state)
If your nexus application didn't startup correct, check the wrapper.log file under $NEXUS_HOME/logs folder. In case you see an error like below, it indicates you don't have the correct java version with which the application was compiled. 

**************
wrapper  | JVM exited while loading the application.
jvm 1    | Exception in thread "main" java.lang.UnsupportedClassVersionError: or
g/sonatype/nexus/bootstrap/jsw/JswLauncher : Unsupported major.minor version 51.
0
jvm 1    |      at java.lang.ClassLoader.defineClass1(Native Method)
jvm 1    |      at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
jvm 1    |      at java.security.SecureClassLoader.defineClass(SecureClassLoader
.java:142)
jvm 1    |      at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
jvm 1    |      at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
jvm 1    |      at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
jvm 1    |      at java.security.AccessController.doPrivileged(Native Method)
jvm 1    |      at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
jvm 1    |      at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
jvm 1    |      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
jvm 1    |      at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
jvm 1    | Could not find the main class: org.sonatype.nexus.bootstrap.jsw.JswLa

**************

Install JDK 1.7.0 and set JAVA_HOME and restart nexus application.



2 comments:

  1. Since I have many jdk's installed and using SLES, I had to redo the symbolic link in /etc/alternatives/java and /etc/alternatives/javaws and it started working.

    ReplyDelete
  2. Thanks @Paul Roesler, should be useful for others.

    ReplyDelete