@@ -52,17 +52,27 @@ sudo tar -xvzf /tmp/nexus-linux-aarch_64.tar.gz \
5252 --keep-directory-symlink
5353```
5454
55+ ---
56+ hideInToc: true
57+ ---
58+
59+ # Symlink latest version to /opt/sonatype/nexus
60+
5561``` bash
5662# Make a symlink to the latest version as /opt/sonatype/nexus to make it easier to upgrade
5763# Pick the latest version explicitly
5864sudo ln -s " $( ls -d /opt/sonatype/nexus-* | sort -V | tail -n 1) " /opt/sonatype/nexus
65+
66+ # Verify
67+ $ readlink /opt/sonatype/nexus
68+ /opt/sonatype/nexus-3.87.1-01
5969```
6070
6171---
6272hideInToc: true
6373---
6474
65- # Create data directory
75+ # Create user for running Sonatype Nexus
6676
6777``` bash
6878# Create user for nexus
@@ -82,6 +92,12 @@ run_as_user="nexus"
8292EOF
8393````
8494
95+ ---
96+ hideInToc: true
97+ ---
98+
99+ # Create data directory
100+
85101` ` ` bash
86102sudo chown -R nexus:nexus /opt/sonatype/sonatype-work
87103` ` `
@@ -114,6 +130,64 @@ chown -R nexus:nexus /var/lib/nexus/javaprefs
114130-Djava.util.prefs.userRoot=/opt/sonatype/sonatype-work/nexus3/javaprefs
115131` ` `
116132
133+ ---
134+ hideInToc: true
135+ ---
136+
137+ https://github.com/sonatype/nexus-public/issues/458
138+
139+ # Choose a password for the admin user
140+
141+ ` ` ` bash
142+ newpass=" superseekret"
143+ oldpass=$( cat /var/lib/nexus/nexus3/admin.password)
144+
145+ curl --include --fail \
146+ --user admin:$oldpass \
147+ -X PUT \
148+ -H ' Content-Type: text/plain' \
149+ --data " ${newpass} " \
150+ http://localhost:8081/service/rest/v1/security/users/admin/change-password
151+ ` ` `
152+
153+ ---
154+ hideInToc: true
155+ ---
156+
157+ # Accept EULA
158+
159+ https://help.sonatype.com/en/eula-rest-api.html
160+
161+ ` ` ` bash
162+ disclaimer=$( curl \
163+ --silent --show-error \
164+ -u admin:$( cat /var/lib/nexus/nexus3/admin.password) \
165+ -X GET ' http://localhost:8081/service/rest/v1/system/eula' | \
166+ jq --raw-output .disclaimer)
167+
168+ curl --include --fail \
169+ -X POST \
170+ -u admin:$( cat /var/lib/nexus/nexus3/admin.password) \
171+ -H ' Content-Type: application/json' \
172+ -d " {\" accepted\" : true, \" disclaimer\" : \" ${disclaimer} \" }" \
173+ http://localhost:8081/service/rest/v1/system/eula
174+ ` ` `
175+
176+ ---
177+ hideInToc: true
178+ ---
179+
180+ # Configure Anonymous Access
181+
182+ ` ` ` bash
183+ curl --include --fail \
184+ --user admin:$newpass \
185+ -X PUT \
186+ -H ' Content-Type: application/json' \
187+ -d ' {"enabled": true, "userId": "anonymous"}' \
188+ http://localhost:8081/service/rest/v1/security/anonymous
189+ ` ` `
190+
117191---
118192layout: section
119193---
@@ -139,6 +213,8 @@ docker container run -d \
139213hideInToc: true
140214---
141215
216+ # Accept EULA
217+
142218https://help.sonatype.com/en/eula-rest-api.html
143219
144220` ` ` bash
0 commit comments