How to Install a Nexus Repository Manager 3 License

This article applies to Nexus Repository Manager 3.1 and greater only.

Install a License Using the User Interface ( recommended )

Installing your product license file using the user interface is the standard method to install your license.

Install a License using the REST API

As of Nexus 3.19.0, there is a REST API that can be used to install a binary license file.

Example:

curl -v -u admin:admin123 -H "Accept: application/json" -H "Content-Type: application/octet-stream" --data-binary @/absolute/path/to/license.lic "http://localhost:8081/service/rest/beta/system/license"

As of 3.21.1, this endpoint is a beta resource: /service/rest/beta/system/license

In newer versions, if the endpoint returns 404, then confirm that the endpoint has not been migrated to a non-beta version by examining the API UI or trying /service/rest/v1/system/license .

How to Install a License Using a System Property

Supported in Nexus 3.6.1 and newer.

This method is mainly intended to assist licensing a brand new setup of a high-availability master node repository manager instance that is unlicensed. If a license is already installed, installing a license using this method will not work.

  1. Locate your repository manager installation <data-directory>. By default this is ./sonatype-work/nexus3 relative to the <app-directory>.
  2. Create a new file, or edit the existing file at path <data-directory>/etc/nexus.properties .
  3. Add the following property in that file:
    nexus.licenseFile=/absolute/path/to/your/nexus/repository/manager/license.lic

    The referenced license.lic file should be the license file you were provided by Sonatype and readable by the user owning the repository manager process.

  4. Start Nexus. The nexus.log will contain messages indicating success or failure of reading the license file using this method. Examples:
    2017-10-23 14:40:19,654-0500 INFO [jetty-main-1] *SYSTEM com.sonatype.nexus.licensing.ext.internal.NexusLicenseInstaller - Installing license from property nexus.licenseFile=/absolute/path/to/your/nexus/repository/manager/license.lic
    2017-10-23 14:40:19,654-0500 INFO [jetty-main-1] *SYSTEM com.sonatype.nexus.licensing.ext.internal.NexusLicenseInstaller -Ignoring property nexus.licenseFile=/absolute/path/to/your/nexus/repository/manager/license.lic. A license is already installed.

How to Override the Installed License File Location

Linux and OSX Only. Windows not applicable.

You can override the default location of the Java user prefs using a system property, which can change the location where the license will be stored or read from.
  1. Find and edit the file <app_dir>/bin/nexus.vmoptions
  2. At the end of the file, add a new line like this:
    -Djava.util.prefs.userRoot=/absolute/path/to/already/created/directory
    

    The absolute path should point to an already created directory readable by the user account owning the repository manager process.

    Under this new directory, Nexus will expect to find the license file at a path com/sonatype/nexus/professional/prefs.xml

    This is also the directory where the product license will be written too when installed by a supported method.

How to Copy an Installed License from Another NXRM

Linux and OSX Only. Windows not applicable.

Once installed, the Nexus Repository Manager license is stored in the Java user preferences store directory for the user which owns the NXRM process. It is technically possible to move an already installed license file from a licensed NXRM server instance to another unlicensed NXRM server instance, since licenses can be installed in multiple servers.

By default. 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

This means you can install the license using a supported method first for one process user, then just copy that file over to a new host or different user account and you'll have an installed license for that process user account as well.

How to Install a License Using the Karaf Console

  1. Stop Nexus gracefully
  2. Enable the Apache Karaf console interface. Edit the file bin/nexus.vmoptions and change this line from "false" to "true":
    -Dkaraf.startLocalConsole=true
  3. Start Nexus in console mode using the run command:
    ./bin/nexus run
    ./bin/nexus /run    (on Windows)
  4. Press enter to drop to the Apache Karaf console prompt, then run the following command:
    nexus:license -m install -f /absolute/path/to/license/file/license.lic
Have more questions? Submit a request

0 Comments

Article is closed for comments.