Setting up a Nexus
Guide to Installing and Using Nexus

- hpyYh
- 2 min read

Nexus Guide
Background
we previously utilized the GitLab Package Registry to maintain pipeline consistency, but we are considering a transition to Nexus due to the following limitations
- Paid Proxy Functionality
- Unstable Backup/Restore Features
- Lack of a GUI-based Upload Feature
Quick Start Guide
Nexus installation
- docker : https://hub.docker.com/r/sonatype/nexus3/
- helm chart : https://artifacthub.io/packages/helm/sonatype/nexus-repository-manager
- ex) Docker
docker run -d \ -p 8081:8081 \ --name nexus \ -v ./nexus-data:/nexus-data \ sonatype/nexus3
Nexus initialization
- initial admin password check
docker exec -it nexus cat /nexus-data/admin.password > 53f2fc25-3685-4eb5-85e2-a7e0b47f057a- admin password change
curl -u admin:53f2fc25-3685-4eb5-85e2-a7e0b47f057a -X PUT "http://localhost:8081/service/rest/v1/security/users/admin/change-password" \ -H "Content-Type: text/plain" \ -d "adminadmin"- anonymous access enable
curl -u admin:adminadmin -X PUT "http://localhost:8081/service/rest/v1/security/anonymous" \ -H "Content-Type: application/json" \ -d '{ "enabled": true, "userId": "anonymous", "realmName": "NexusAuthorizingRealm" }'- egov create repository
curl -u admin:adminadmin -X POST 'http://localhost:8081/service/rest/v1/repositories/maven/proxy' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "egov-proxy", "online": true, "storage": { "blobStoreName": "default", "strictContentTypeValidation": true }, "proxy": { "remoteUrl": "https://maven.egovframe.go.kr/maven/", "contentMaxAge": 1440, "metadataMaxAge": 1440 }, "negativeCache": { "enabled": true, "timeToLive": 1440 }, "httpClient": { "autoBlock": true, "blocked": false }, "maven": { "versionPolicy": "RELEASE", "layoutPolicy": "STRICT", "contentDisposition": "ATTACHMENT" } }'- npm create repository
curl -u admin:adminadmin -X POST "http://localhost:8081/service/rest/v1/repositories/npm/proxy" \ -H "Content-Type: application/json" \ -d '{ "name": "npm-proxy", "online": true, "storage": { "blobStoreName": "default", "strictContentTypeValidation": true }, "proxy": { "remoteUrl": "https://registry.npmjs.org", "contentMaxAge": 1440, "metadataMaxAge": 1440 }, "negativeCache": { "enabled": true, "timeToLive": 1440 }, "httpClient": { "autoBlock": true, "blocked": false } }'backend proxy apply
- gradle cache clear ( mac ex : rm -rf ~/.gradle/caches/ )
- build.gradle modify
repositories { maven { url "http://localhost:8081/repository/maven-public/" allowInsecureProtocol = true } maven { url "http://localhost:8081/repository/egov-proxy/" allowInsecureProtocol = true } }frontend proxy apply
npm config set registry http://localhost:8081/repository/npm-proxy/npm install & npm run build
backup
- To migrate proxied or manually registered libraries to the production environment, you can simply overwrite the blobs and db folders within nexus-data in their entirety.
browser
- http://localhost:8081/
- tags :
- Nexus