Kokil Thapa - Professional Web Developer in Nepal
Freelancer Web Developer in Nepal with 15+ Years of Experience

Kokil Thapa is an experienced full-stack web developer focused on building fast, secure, and scalable web applications. He helps businesses and individuals create SEO-friendly, user-focused digital platforms designed for long-term growth.

Nexus Repository Manager Guide

By Kokil Thapa | Last reviewed: September 2026

Your builds fail when npmjs.com or repo.maven.apache.org blips for thirty seconds. A solid Nexus Repository Manager guide fixes that by giving your team one internal hub for Composer, npm, Maven, and Docker artifacts. On production Laravel and eCommerce projects, I've seen slow or blocked upstream pulls waste hours every month. Nexus sits between developers, CI runners, and public registries so dependencies download once and reuse locally. This page walks through install, repository design, client config, security, and the mistakes that break real pipelines.

What is Nexus Repository Manager and why should your team use it?

Nexus Repository Manager is Sonatype's binary artifact hub. It stores your own packages and mirrors public registries. Think of it as an internal CDN for dependencies. Your enterprise application stack stops treating npm, Packagist, and Maven Central as single points of failure.

Three repository types drive every Nexus design:

  • Hosted — stores artifacts you publish (internal Composer packages, release JARs, private npm scopes).
  • Proxy — caches upstream content from Packagist, npmjs, Maven Central, or Docker Hub on first request.
  • Group — merges hosted and proxy repos behind one URL clients actually use.

On client projects where GitLab CI runs Composer and npm on every push, a local proxy cut install time from minutes to seconds after the first build. That pattern mirrors what I use on sister sites sharing a Ubuntu repository management workflow with Deployer 7 releases.

Nexus Repository Manager Guide — Core ArchitectureDevelopersLocal buildsCI RunnersGitLab / JenkinsNexus 3Hosted + Proxy+ Group reposPackagistMaven Centralnpm registryDocker HubPyPI / NuGetOther upstreamFirst request fetches upstream; later requests serve from local blob store
Nexus Repository Manager guide — how developers, CI, and upstream registries connect through one artifact hub

Nexus 3 (current Sonatype line) supports Maven, npm, NuGet, PyPI, RubyGems, Docker, Helm, and more. For PHP teams on Laravel 12 or 13 with Composer 2.10, a Composer proxy plus hosted repo is usually enough. Node 26 LTS front-end builds benefit the same way from an npm group repository.

How do you install Nexus Repository Manager on Ubuntu?

Run Nexus on a dedicated VM with fast disk and enough RAM. Sonatype recommends 4 GB minimum for small teams; 8 GB is safer once Docker and npm proxies fill the blob store. I've provisioned similar hosts using Ansible playbooks for PHP server provisioning on Ubuntu 22 or 24.

Download and create the nexus user

  1. Create a system user with a home directory under /opt/nexus.
  2. Download the latest Nexus 3 OSS tarball from Sonatype's official download page.
  3. Extract to /opt/nexus and point a nexus symlink at the versioned folder.
  4. Set ownership: chown -R nexus:nexus /opt/nexus /opt/sonatype-work.
sudo useradd --system --home-dir /opt/nexus --shell /bin/bash nexus
cd /opt
sudo wget https://download.sonatype.com/nexus/3/latest-unix.tar.gz
sudo tar xzf latest-unix.tar.gz
sudo ln -sfn nexus-3.* nexus
sudo mkdir -p /opt/sonatype-work
sudo chown -R nexus:nexus /opt/nexus /opt/sonatype-work

Systemd service and reverse proxy

Nexus ships a sample systemd unit. Set run_as_user=nexus in nexus.vmoptions. Limit JVM heap in the same file — typically -Xms2g -Xmx2g on an 8 GB box. Enable and start the service, then put Nginx or Apache in front for TLS.

# /etc/systemd/system/nexus.service
[Unit]
Description=Nexus Repository Manager
After=network.target

[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
User=nexus
Restart=on-abort

[Install]
WantedBy=multi-user.target

Default port is 8081. Initial admin password lives in /opt/sonatype-work/nexus3/admin.password. Change it on first login. For production, terminate TLS at Nginx and restrict port 8081 to localhost. Patterns overlap with Kubernetes ingress and TLS with cert-manager when Nexus runs inside a cluster instead of a bare VM.

Budget roughly Rs 3,000–8,000/month (~USD 22–60) for a small VPS with 4–8 GB RAM in Nepal or regional cloud zones. Disk grows with cached artifacts — plan 50 GB minimum, more if you proxy Docker layers.

How do you configure Maven, npm, and Composer repositories in Nexus?

Repository design matters more than any single setting. A common mistake is pointing clients directly at a proxy repo. Use a group that lists hosted first, then proxy. Nexus searches members in order and returns the first match.

Composer and PHP / Laravel projects

In the Nexus UI, go to Settings → Repositories → Create repository. Add these three:

  1. composer-hosted — type hosted, for your private packages.
  2. composer-proxy — type proxy, remote URL https://repo.packagist.org.
  3. composer-group — type group, members: hosted, then proxy.

Point project composer.json repositories at the group URL:

{
  "repositories": [
    {
      "type": "composer",
      "url": "https://nexus.example.com/repository/composer-group/"
    }
  ],
  "config": {
    "secure-http": true
  }
}

Authenticate with HTTP basic auth or a user token. Store credentials in CI variables, not in git. See manage secrets with AWS Secrets Manager for one pattern; GitLab masked variables work too.

npm for Vite 8.x and Node 26 LTS builds

Create npm hosted, npm proxy (remote https://registry.npmjs.org), and npm group repos. Configure the client:

npm config set registry https://nexus.example.com/repository/npm-group/
npm login --registry=https://nexus.example.com/repository/npm-group/

For scoped packages you publish internally, use npm publish --registry=https://nexus.example.com/repository/npm-hosted/. CI pipelines on projects like Adventure Third Pole Trek repeat the same registry URL in every job so cache hits stay predictable.

Hosted, Proxy, and Group RepositoriesHostedYour releasesInternal libsProxyCache upstreamPackagist / npmGroupSingle client URLSearch orderClient requests laravel/frameworkGroup checks hosted → miss → proxy fetches Packagist → cachedAlways point Composer, npm, and Maven clients at the group URL
Nexus Repository Manager guide — hosted, proxy, and group repository roles in a typical PHP or Node stack

Maven for Java sidecars and Android builds

Java teams use the same trio: maven-releases (hosted), maven-central (proxy), maven-public (group). Publish with mvn deploy aimed at the hosted releases URL. Consumer pom.xml or settings.xml references the group.

<settings>
  <mirrors>
    <mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>https://nexus.example.com/repository/maven-public/</url>
    </mirror>
  </mirrors>
</settings>

Do not confuse this Maven mirror with the Laravel repository pattern for Eloquent. Same word, different layer — Nexus handles binary packages, not database access code.

How do you secure Nexus and integrate it with CI/CD?

An open Nexus instance on the public internet is a liability. Attackers have scanned for anonymous write access on misconfigured registries. Lock it down before you cache anything sensitive.

RBAC, anonymous access, and cleanup

Disable anonymous access unless you have a deliberate read-only public mirror behind a firewall. Create roles per team: npm-read, composer-deploy, docker-push. Assign users or CI tokens to those roles only.

  • Enable Cleanup policies on proxy repos so old snapshot caches do not fill the disk.
  • Turn on Blob store monitoring — alert when free space drops below 20%.
  • Export config regularly with the REST API or UI backup.
  • Run Nexus behind VPN or IP allowlists if the team is small and mostly in one office.

For credential rotation, treat Nexus tokens like database passwords. I've seen stale CI variables cause confusing 401 errors that look like package version conflicts. A quick test with JSON formatter on API error responses saves debug time.

GitLab CI example for Laravel

Cache Composer and npm through Nexus in every pipeline stage that installs dependencies:

variables:
  COMPOSER_AUTH: '{"http-basic":{"nexus.example.com":{"username":"ci","password":"$NEXUS_CI_TOKEN"}}}'
  NPM_CONFIG_REGISTRY: "https://nexus.example.com/repository/npm-group/"

composer_install:
  script:
    - composer install --no-dev --prefer-dist --no-interaction
  cache:
    key: composer-$CI_COMMIT_REF_SLUG
    paths:
      - vendor/

npm_build:
  script:
    - npm ci
    - npm run build
  cache:
    key: npm-$CI_COMMIT_REF_SLUG
    paths:
      - node_modules/

Pair this with AI code review in your CI pipeline only after dependency installs are stable. Broken registry auth wastes every downstream job. Our support and maintenance service often starts with fixing exactly these pipeline fragility issues on long-running client apps.

CI/CD Flow Through NexusGit PushGitLab CINexuscomposer-groupnpm-groupBuild + TestArtifactDeployer 7 / SSH releaseProduction PHP-FPM reloadCached deps mean identical installs on laptop and CI runnerGotcha: rotate NEXUS_CI_TOKEN when jobs suddenly return 401
Nexus Repository Manager guide — GitLab CI dependency flow from push to production deploy

Nexus Repository Manager vs JFrog Artifactory: which should you choose?

Both products solve artifact management. Your choice depends on budget, formats, and ops capacity. Nexus OSS is free for core features; Artifactory's full feature set sits behind paid tiers.

CriteriaSonatype Nexus 3 OSSJFrog Artifactory
License costFree OSS; Pro/Enterprise paidFree tier limited; production usually paid
Composer / npm / MavenStrong native supportStrong native support
UI learning curveModerate; well-documentedModerate; more enterprise menus
Docker registrySupported (port per repo or reverse proxy)Supported with built-in path routing
High availabilityPro/Enterprise clusteringBuilt-in HA in paid editions
Best fitSmall/medium teams, PHP/Node/Java stacksLarge orgs needing universal packages + HA

For a deeper side-by-side, read our artifact management with Nexus and Artifactory comparison. Most Nepal agencies I work with pick Nexus OSS on a single Ubuntu box until traffic demands clustering. That matches the boring-infrastructure philosophy on Linux system administration engagements — prove value before buying enterprise licenses.

What are common Nexus Repository Manager problems and how do you fix them?

Production Nexus issues cluster around disk, permissions, and misconfigured URLs. These fixes cover ninety percent of tickets I've seen.

Disk full and slow blob store

Symptom: HTTP 507 or UI warnings. Run cleanup policies on proxy repositories. Compact blob stores during a maintenance window from Administration → Tasks. Add volume before compact fails mid-run.

401 Unauthorized in CI but local works

Compare COMPOSER_AUTH or npm tokens between laptop and pipeline. GitLab protected variables do not expose to unprotected branches. Confirm the CI user has nx-repository-view-* privileges on the group repo, not only the hosted repo.

SSL and reverse proxy errors

Nexus behind Nginx needs correct X-Forwarded-* headers. Set nexus-context-path if serving under a subpath. Mixed HTTP/HTTPS in repository URLs causes redirect loops in Composer.

Wrong repository pattern in application code

If developers mention "repository" bugs in Laravel, confirm they mean Composer/Nexus — not Eloquent data access. The naming collision trips up junior devs. Point them to repository pattern anti-patterns for the application-layer topic, not this artifact manager.

Troubleshooting Decision TreeBuild failed?401 errorCheck CI tokenTimeoutUpstream down?507 / slowDisk / cleanupFix RBAC + varsUse proxy cacheRun blob compactOfficial docs: help.sonatype.com — Repository Manager 3 REST API
Nexus Repository Manager guide — quick decision tree for 401, timeout, and disk errors

Sonatype publishes task schedules and health check endpoints in the Repository Manager 3 documentation. Bookmark the REST API section for scripting repository exports during disaster-recovery drills.

Key Takeaways

  • Install Nexus 3 on Ubuntu with a dedicated nexus user, systemd unit, and TLS reverse proxy — never expose port 8081 raw to the internet.
  • Create hosted + proxy + group repos for each format; point Composer, npm, and Maven clients only at the group URL.
  • Disable anonymous write, use CI tokens with least privilege, and schedule cleanup policies before disk fills.
  • Wire GitLab CI variables (COMPOSER_AUTH, NPM_CONFIG_REGISTRY) so laptop and pipeline share the same cached upstream.
  • Compare Nexus OSS vs Artifactory on license, HA needs, and team size before paying for enterprise features.
  • When builds fail, check auth tokens first, upstream second, disk third — that order matches most real incidents.

People Also Ask

Is Nexus Repository Manager free?

Nexus Repository Manager OSS is free and covers Maven, npm, Docker, and Composer for most small and medium teams. Sonatype sells Pro and Enterprise tiers with advanced security scanning, high-availability clustering, and support SLAs. Start with OSS on a single node until you outgrow it.

Can Nexus replace Packagist or npmjs entirely?

Not for public open-source consumption worldwide. Nexus proxies and caches those upstream registries for your organisation. You still need internet on first fetch. After cache warm-up, builds survive short upstream outages because artifacts live in your blob store.

How much disk space does Nexus need?

Plan 50 GB minimum for a PHP and Node shop with moderate CI volume. Docker proxy repos grow fastest. Monitor blob store usage weekly and set cleanup policies to drop unused cache older than 30–90 days depending on compliance needs.

Does Nexus work with Laravel and WordPress projects?

Yes. Laravel apps use Composer through a Composer proxy/group. WordPress plugins and themes that ship Node build steps benefit from an npm group repo the same way. The application stack does not change — only registry URLs and CI credentials do.

Build faster pipelines with a local artifact hub

This Nexus Repository Manager guide gives you a repeatable path from bare Ubuntu install to cached Composer and npm pulls in GitLab CI. The payoff is fewer red builds, predictable deploys, and less dependence on public registry uptime. If you want help standing up Nexus alongside Deployer releases, PHP-FPM tuning, or a full custom software development pipeline, review our Notary Kathmandu sister-site DevOps work or browse more guides on the blog. Contact us to plan registry setup, CI hardening, or migration from a flaky direct-upstream workflow.

Frequently Asked Questions

Sonatype's binary artifact hub. It stores your published packages and mirrors public registries like Packagist and npmjs, giving your team one internal dependency cache.

Provision a dedicated VM on Ubuntu 22 or 24 with fast disk and at least 4 GB RAM, though 8 GB is safer once Docker and npm proxies fill the blob store. Create a system nexus user, download the latest Nexus 3 OSS tarball from Sonatype, extract to /opt/nexus, and chown /opt/nexus and /opt/sonatype-work. Enable the sample systemd unit with run_as_user=nexus and JVM heap limits in nexus.vmoptions, then put Nginx or Apache in front for TLS. Default port is 8081; change the initial admin password from /opt/sonatype-work/nexus3/admin.password on first login.

Hosted stores artifacts you publish internally, such as private Composer packages or release JARs. Proxy caches upstream content from Packagist, npmjs, or Maven Central on first request. Group merges hosted and proxy repos behind one URL clients actually use. Nexus searches group members in order and returns the first match, so list hosted before proxy. A common mistake is pointing Composer, npm, or Maven clients directly at a proxy repo instead of the group.

In the Nexus UI under Settings, create three repos: composer-hosted for private packages, composer-proxy pointing at https://repo.packagist.org, and composer-group listing hosted first then proxy. Point project composer.json repositories at the group URL and set secure-http to true. Authenticate with HTTP basic auth or a user token, storing credentials in CI variables rather than git. On GitLab CI, set COMPOSER_AUTH with the Nexus username and token so Laravel 12 or 13 builds with Composer 2.10 pull cached upstream artifacts after the first install.

Create npm-hosted, npm-proxy with remote URL https://registry.npmjs.org, and npm-group repos. Configure clients with npm config set registry pointing at the group URL, then npm login against that registry. Publish internal scoped packages to npm-hosted with npm publish --registry. In GitLab CI, set NPM_CONFIG_REGISTRY to the group URL in every job that runs npm ci or npm run build so Node 26 LTS and Vite 8.x pipelines get predictable cache hits across pushes.

Nexus OSS itself is free. Hosting runs roughly Rs 3,000–8,000/month (~USD 22–60) for a small VPS with 4–8 GB RAM in Nepal or regional cloud zones, plus disk that grows with cached artifacts.

Nexus OSS is free and covers Maven, npm, Docker, and Composer for most small and medium teams. Sonatype sells Pro and Enterprise tiers with advanced security scanning, high-availability clustering, and support SLAs. Start with OSS on a single node until you outgrow it.

Never expose port 8081 raw to the internet; terminate TLS at Nginx and restrict 8081 to localhost. Disable anonymous access unless you deliberately need read-only access behind a firewall. Create RBAC roles per team such as npm-read, composer-deploy, and docker-push, assigning CI tokens with least privilege only. Enable cleanup policies on proxy repos, monitor blob store free space with alerts below 20%, and export config regularly via REST API or UI backup. Run Nexus behind VPN or IP allowlists for small teams, and rotate Nexus tokens like database passwords.

Set pipeline variables so laptop and CI share the same registry: COMPOSER_AUTH as JSON http-basic credentials for nexus.example.com, and NPM_CONFIG_REGISTRY pointing at the npm-group URL. Run composer install with --no-dev --prefer-dist in a cached vendor/ job, and npm ci plus npm run build in a cached node_modules/ job. Confirm the CI user holds nx-repository-view privileges on the group repo, not only hosted. Fix dependency auth before adding downstream steps like AI code review, because broken registry credentials waste every later job.

Both manage binary artifacts with strong Composer, npm, and Maven support. Nexus OSS is free for core features; Artifactory's full production feature set usually requires paid tiers. Nexus suits small and medium PHP, Node, and Java stacks on a single Ubuntu box. Artifactory fits larger orgs needing built-in HA in paid editions and universal package routing. Docker registry works on both; Artifactory offers built-in path routing while Nexus may use port-per-repo or reverse proxy. Most Nepal agencies I work with pick Nexus OSS until traffic demands Pro clustering.

A group merges your hosted internal packages and cached upstream proxy content behind one URL. Nexus searches members in order and returns the first match, so hosted must be listed before proxy. Pointing Composer, npm, or Maven directly at proxy skips your published artifacts and breaks the pattern where CI and developers share one predictable endpoint. On client projects where GitLab CI runs Composer and npm on every push, the group URL cut install time from minutes to seconds after the first build warmed the cache.

Compare COMPOSER_AUTH or npm tokens between your laptop and the pipeline. GitLab protected variables do not expose to unprotected branches, which often looks like a package version conflict. Confirm the CI user has nx-repository-view privileges on the group repository, not only the hosted repo. Stale CI variables after token rotation are a pattern I have seen repeatedly. Test API error responses with a JSON formatter to separate auth failures from dependency resolution problems quickly.

Symptoms include HTTP 507 responses and UI warnings about free space. Run cleanup policies on proxy repositories to drop unused cache, typically older than 30–90 days depending on compliance needs. Compact blob stores during a maintenance window from Administration → Tasks, but add volume before compact fails mid-run. Plan 50 GB minimum for a PHP and Node shop with moderate CI volume; Docker proxy repos grow fastest. Monitor blob store usage weekly and alert when free space drops below 20%.

Not for public open-source consumption worldwide. Nexus proxies and caches those upstream registries for your organisation. You still need internet on first fetch. After cache warm-up, builds survive short upstream outages because artifacts live in your blob store.

Yes. Laravel apps use Composer through a Composer proxy and group setup without changing the application stack, only registry URLs and CI credentials. WordPress plugins and themes that ship Node build steps benefit from an npm group repo the same way Vite 8.x front-end builds do. The payoff is fewer red builds when repo.maven.apache.org or npmjs.com blips for thirty seconds, because dependencies download once into Nexus and reuse locally across developers and GitLab CI runners on every push.

Share this article

0 Comments

Leave a comment

Your email is not published. Comments appear once they have been read. Sign in to have your details filled in.

Quick Contact Options
Choose how you want to connect me: