Overview:
Nexus license file can be installed via different methods.
- By adding nexus.licenseFile option in nexus.properties file
- By using -Dnexus.licenseFile=/path/to/license.lic option in nexus.vmoptions file or with java argument.
- Updating via Nexus UI.
- Added via base64 in values.yaml file or or saved in AWS Secrets and referenced inside Pods in container environments
Nexus Repository Manager stores this license on each nodes filesystem. By default its stored under the process users home directory. If repo is running as user nexus, then its stored under below file.
/home/nexus/.java/.userPrefs/com/sonatype/nexus/professional/prefs.xml
This location can be modified using -Djava.util.prefs.userRoot Java argument. For Nexus HA deployments using our helm chart, this location is set to Pods persistent Storage location, ${NEXUS_DATA}/javaprefs
This file takes precedence over all other license file input methods. License details in this file is updated when new license is installed via Nexus UI or REST API.
Updating License in Standalone Deployments:
We recommend below steps to update new license on standalone instances
1. Obtain new license from Sonatype (before current license expires)
2. Login to Nexus UI as Admin User and Go to Administration --> System --> Licensing
3. Click "Choose File" and select the new license file. Click "Upload License" to update the license
4. Changes take effect immediately (Optional restart is only required if new license has new features. )
5. Copy the new license to nexus host and update the corresponding files (nexus.properties or nexus.vmoptions or nexus startup file) appropriately for consistency.
Updating License in Nexus HA Deployments:
Container environments
Generally for HA deployments on container environments, the license files are saved as secrets and license details are stored in prefs.xml files on the corresponding pods persistent storage. Thus when a new license is obtained it has to be updated on both secrets and prefs.xml file.
To update license secrets, we can directly edit and replace content with new license file, using below steps.
1. Obtain the new license file (this example users new-license.lic as file name)
2. Get existing license secret name (when deployed with our helm chart, default name is nexus-repo-license.lic)
$ kubectl get secrets -n nexusrepo
NAME TYPE DATA AGE
nexus-repo-license.lic Opaque 1 44h
nxrm-ha-adminsecret Opaque 1 44h
nxrm-ha-dbsecret Opaque 3 44h
3. Replace the existing secrets license data with new license file.
$ kubectl create secret generic nexus-repo-license.lic -n nexusrepo --from-file=nexus-repo-license.lic=./new-license.lic --dry-run=client -o yaml | kubectl apply -f -
$ kubectl get secrets -n nexusrepo -o yaml
In HA container environments, nexus UI is generally accessible via a load balancer which connects to any of the backend HA node. This presents a small challenge in updating the new license via nexus UI. Thus we suggest to use REST API on each container instead.
Follow below steps to update license on Nexus HA deployments on container environments.
1. Find the Nexus HA Pod names
$ kubectl get pods -n nexusrepo
NAME READY STATUS RESTARTS AGE
nxha1-nxrm-ha-0 4/4 Running 7 (18h ago) 18h
nxha1-nxrm-ha-1 4/4 Running 7 (18h ago) 18h
2. Copy the new license file to all the Nexus HA containers
$ kubectl cp nx-license.lic -n nexusrepo -c nxrm-app nxha1-nxrm-ha-0:/tmp
$ kubectl cp nx-license.lic -n nexusrepo -c nxrm-app nxha1-nxrm-ha-1:/tmp
3. Execute below curl command to upload the license file, to nexus, on individual Pods
$ kubectl -n nexusrepo -c nxrm-app exec -it nxha1-nxrm-ha-0 -- /usr/bin/curl -v \
-u admin:admin123 \
-H "accept: application/json" -H "Content-Type: application/octet-stream" \
--data-binary '@/tmp/nx-license.lic' \
'http://localhost:8081/service/rest/v1/system/license'
e.g: pod2
$ kubectl -n nexusrepo -c nxrm-app exec -it nxha1-nxrm-ha-1 -- /usr/bin/curl -v \
-u admin:admin123 \
-H "accept: application/json" -H "Content-Type: application/octet-stream" \
--data-binary '@/tmp/nx-license.lic' \
'http://localhost:8081/service/rest/v1/system/license'
4. Confirm the new license update by running below REST API on each nexus Pod
$ kubectl -n nexusrepo -c nxrm-app exec -it nxha1-nxrm-ha-0 -- /usr/bin/curl -v \
-u admin:admin123 \
'http://localhost:8081/service/rest/v1/system/license'
{
"contactEmail" : "cust@myorg.com",
"contactCompany" : "My Org",
"contactName" : "My Customer",
"effectiveDate" : "2024-07-09T20:53:32.012+00:00",
"expirationDate" : "2024-07-18T00:00:00.000+00:00",
"licenseType" : "Nexus IQ Server, Nexus Repository Pro",
"licensedUsers" : "1000",
"fingerprint" : "f3018f49b714ae4a6f42489b5ecccaddddc8df4",
"features" : "SonatypeCLM, NexusProfessional"
}
Or confirm the same via Nexus UI