Skip to main content

Installing and Updating Licenses

Note

Only available in Sonatype Nexus Repository Pro. Interested in a free trial? Start here.

Prerequisites

  • To use Nexus Repository Pro and its features, you will need a paid license.

  • Managing licenses requires nx-admin or nx-license privileges.

Installing or Updating a License Using the REST API

You can also use the licensing API to install a binary license file as shown in the following 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/v1/system/license"

Note

For older versions, this endpoint may be a beta resource that would use "http://localhost:8081/service/rest/beta/system/license" instead of v1.

Installing or Updating a License Using a System Property

Note

This method of installing a license will only work on new setups where a license is not yet installed.

To install a license using a system property, complete the following steps:

  1. Locate your repository manager installation data directory. By default, the data directory is found at../sonatype-work/nexus3.

  2. Either create a new file or edit the existing file at path $data-dir/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 that Sonatype provided you and should be readable by the user owning the repository manager process.

  4. Start Nexus Repository.

The nexus.log will contain a log message indicating success or failure of reading the license file using this method.

Log message indicating the property is being used to load a license file:

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

Log message indicating that a newer or the same license is already installed in the OS user Java preferences location, so the one referenced by the property is being ignored:

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.

Overriding the Installed License File Location

Note

This section is only applicable to Linux and MacOS; it does not apply to Windows environments.

Use the following steps to override the default location of the Java user preferences using a system property that changes the location of where the license is stored or from which it is read:

  1. Find and edit the <app_dir>/bin/nexus.vmoptions file.

  2. At the end of the file, add a new line like the following:

    -Djava.util.prefs.userRoot=/absolute/path/to/already/created/directory

    Note

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

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

This is also the directory to which the product license will be written when installed through a supported method.

Copying an Installed License from Another Nexus Repository Instance

Note

This section is only applicable to Linux and MacOS; it does not apply to Windows environments.

Once installed, the Nexus Repository license is stored in the Java user preferences store directory for the user that owns the Nexus Repository process. It is possible to move an already installed license from a licensed Nexus Repository instance to another unlicense instance since you can install licenses on multiple servers.

By default, you will find the product license in the home directory of the user running Nexus Repository at this location:

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

You can install the license using a supported method for one process user and then copy the file to a new host or different user account. Then, you will have an installed license for both process users.

Monitoring Recent Connections for Product License Compliance

If you wish to approximate the number of unique users accessing Nexus Repository, we recommend using a log parser on the request.log files. By default, the IP address and autheticated user ID associated with each request will appear in columns 1 and 3 of each log line respectively.

You can also use LDAP queries against your LDAP server to help verify the number of unique users configured to access or are potentially accessing a Nexus Repository instance.

See our knowledge base article for more information.

What Happens if my Installed License Expires?

All functionality ceases except the ability to install a new license and generate a support zip.