Alternative methods to install your Nexus Repository Manager 2.x license

This article applies to Nexus Repository Manager 2.x only.

Nexus Repository Manager 2: In some browser and Nexus version combinations, there were problems uploading a Nexus license file using the user interface.

If you find yourself in a similar situation, you should be able to upload your license file using a common command line utility called curl to bypass the UI entirely.

Option 1: Uploading a License file Using REST

Example uploading a license file to Sonatype Nexus Professional:

> curl -v -F "file=@your-license-file.lic" -u admin:admin123 "http://localhost:8081/nexus/service/local/licensing"
* About to connect() to localhost port 8081 (#0)
*   Trying ::1...
* Adding handle: conn: 0x7f8ab2803000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f8ab2803000) send_pipe: 1, recv_pipe: 0
* Connected to localhost (::1) port 8081 (#0)
* Server auth using Basic with user 'admin'
> POST /nexus/service/local/licensing/request.html HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4xMjM=
> User-Agent: curl/7.32.0
> Host: localhost:8081
> Accept: */*
> Content-Length: 3269
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------599c88cde3474225
> 
< HTTP/1.1 100 Continue
< HTTP/1.1 201 Created
< Date: Wed, 30 Oct 2013 13:12:32 GMT
< Date: Wed, 30 Oct 2013 13:12:34 GMT
* Server Noelios-Restlet-Engine/1.1.6-SONATYPE-5348-V8 is not blacklisted
< Server: Noelios-Restlet-Engine/1.1.6-SONATYPE-5348-V8
< Content-Length: 0
< 
* Connection #0 to host localhost left intact 

Option 2: Copying the license file into place

The Nexus license is stored in the Java user preferences store directory on Linux and Mac OSX. This solution will not work for Windows, as the license is stored in the Windows Registry there.

Once installed, on Linux the product license can be found in the home directory of the user running Nexus at this location:

~/.java/.userPrefs/com/sonatype/nexus/professional/prefs.xml

So you can install the license through the UI on one host and then just copy that file over to a new host or different user account and you'll have an installed license for that user account.

You can also override the default location of the Java user prefs using a system property, which can change the location where the license will be stored and read from.

Find and edit the file $NEXUS_HOME/bin/jsw/conf/wrapper.conf

Look for lines like this:

wrapper.java.additional.1=-XX:MaxPermSize=192m
wrapper.java.additional.2=-Djava.net.preferIPv4Stack=true
wrapper.java.additional.3=-Dcom.sun.jndi.ldap.connect.pool.protocol="plain ssl"
wrapper.java.additional.3.stripquotes=TRUE

Add a new line below them like this:

wrapper.java.additional.4=-Djava.util.prefs.userRoot=<absolute-path-to-already-created-directory>

Be sure to set the sequence number (shown here as "4") to the next unused sequence number in the wrapper.java.additional list or it will not work.

Have more questions? Submit a request

2 Comments

  • 0
    Avatar
    Adrian

    Hi Peter,

    I am using Nexus Repository Manager version 2.12.0-01 and it seems like this no longer works. Is there, by any chance, a way to do this or something similar on newer versions of Nexus?

    Cheers,

    Adrian

    EDIT:

    USER ERROR

    Edited by Adrian
  • 0
    Avatar
    Peter Lynch

    We are closing this article for comments.

    If you have a support license, please contact us by submitting a support ticket.

    If you do not have a support license, please use our Nexus Users List or our other free support resources.

Article is closed for comments.
Powered by Zendesk