Skip to main content

Sonatype Nexus Repository License Management

Before you can access Nexus Repository Pro features, you will need to install a Nexus Repository Pro license.

Nexus Repository license management differs between single-instance and clustered high availability (HA) deployments. In a single-instance deployment, you will manage one license through either the user interface (UI), REST API, or system properties. However, in an HA deployment, you should avoid using the user interface for any license management as you cannot be sure which of your Nexus Repository instances you would be modifying at any given time.

What Happens if my Installed License Expires?

If your installed license expires, all Nexus Repository functionality ceases except for the ability to install a new license or generate a support zip. To install a new license, follow the instructions for installing a license for your single-instance deployment or installing a license in a clustered (HA or resiliency) deployment.

Detailed information about installing and updating licenses can be found in the following sections:

Installing and Updating Licenses in a Single-Instance Deployment

This section covers license installation and upgrades in single-instance Nexus Repository deployments. For information on managing licenses in high availability (HA) or resilient deployments, see our help documentation for managing licenses in a clustered environment. Note that managing Nexus Repository licenses requires nx-admin or nx-license privileges.

To install a Nexus Repository Pro license in a single-instance deployment for either the first time or to update an existing license, complete the following steps:

  1. Navigate to Administration (cog icon) → SystemLicensing in the user interface.

  2. Under Install License, select Choose File.

  3. Select the correct .lic file, then select Open.

  4. Select the Upload License button.

  5. Select I Accept to accept the terms stated in the End User License Agreement.

  6. Restart Nexus Repository for the new license to take effect.

After you have restarted Nexus Repository, the License type shown in the Licensing panel will display the features associated with your license.

The licensing API allows you to both install or uninstall a Nexus Repository Pro binary license file. Note that if you are removing a license in a containerized or OpenShift environment, you should use the REST API for removing the license. The REST API method for uninstalling a license deletes the license from wherever Nexus Repository has stored it, ensuring that the old license is truly removed. You may then use either the user interface or API for installing a new one.

The example below shows how to install an initial license:

curl -v -u admin:admin123 -H "Accept: application/json" -H "Content-Type: application/octet-stream" --data-binary @/absolute/path/to/license.lic "{nexusHost}/service/rest/v1/system/license"

To update an expired license, uninstall the license using the licensing API as shown in the example below:

curl -X 'DELETE' \
  'http://{nexusHost}/service/rest/v1/system/license' \
  -H 'accept: application/json' \
  -u {username}:{password}

After uninstalling your old license, install a new one as shown in the first example.

Note that installing a license using a system property 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.

Installing and Updating Licenses in a High Availability or Resilient Deployment

Since clustered environments (high availability (HA) or resiliency) involve a load balancer, you must consider this when managing licensing in these environments. The load balancer has its own IP address as does each Nexus Repository instance; this has implications when using the REST API for license management. Moreover, in HA environments, you may be making changes to any one of them if you do so through the user interface; therefore, as a best practice, do not use the user interface to manage licensing in an HA deployment.

If you are updating a Nexus Repository license (expired or unexpired) in a resilient or HA deployment, you should uninstall the existing license using the licensing REST API regardless of how you originally installed the existing license. The REST API method for uninstalling a license deletes the license from wherever Nexus Repository has stored it, ensuring that the old license is truly removed.

An example of using the REST API to uninstall a Nexus Repository license is below.

curl -X 'DELETE' \
  'http://{nexusHost}/service/rest/v1/system/license' \
  -H 'accept: application/json' \
  -u {username}:{password}

Ensure You Use the Correct IP Address(es) when Uninstalling a License in a Resilient or High Availability Deployment

If you are in a resilient deployment (only one active Nexus Repository instance at any given time), you can use the load balancer's IP address when deleting the license.

If you are in an HA environment, you must use the REST API on each Nexus Repository instance's IP address, not the load balancer's IP address

After removing the old license, you can use any supported method for installing a new license.