Developer Tools Azure

Verdaccio 7.1 on Ubuntu 26.04 on Azure User Guide

| Product: Verdaccio 7.1 on Ubuntu 26.04 LTS on Azure

Overview

Verdaccio is a lightweight open source private npm registry and proxy cache built on Node.js. Teams use it to publish private packages, to cache packages from the public npm registry so installs keep working when npmjs.com is slow or unreachable, and to control who can read and publish with simple accounts. It works with npm, pnpm, Yarn and Bun. The cloudimg image delivers Verdaccio 7.1.3 on Node.js 24 LTS fully installed and configured on Ubuntu 26.04 LTS: Verdaccio behind nginx over HTTPS, with its configuration, packages and accounts on their own 20 GiB data disk. The admin account is made on the first boot of your VM, so you land on a private registry with nothing to configure. cloudimg's support team is on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours.

Verdaccio is distributed under the MIT License (/usr/lib/node_modules/verdaccio/LICENSE on the image); its source is published on GitHub. cloudimg is not affiliated with, endorsed by, or sponsored by the Verdaccio project. This image repackages the upstream release with cloudimg's provisioning and support.

What is included:

  • Verdaccio 7.1.3 installed from npm into Node.js 24 LTS (NodeSource's signed apt repository), run as the unprivileged verdaccio user by verdaccio.service, listening on loopback only
  • nginx in front of it: HTTPS on :443 (HTTP/2) for the web UI and the npm registry, with :80 redirecting to HTTPS and answering a plain /health check
  • An uplink to the public npm registry: any package not published on your registry is fetched once and cached
  • Every package, private or proxied, behind a sign-in: anonymous visitors see and install nothing
  • Sign-up closed: npm adduser cannot create accounts; you add them yourself
  • A 20 GiB data disk mounted at /var/lib/verdaccio holding the configuration, the packages and the account database, so you can grow or snapshot it on its own
  • A per-VM admin password and TLS certificate, both made on first boot. The sign-in details go to the root-only file /root/verdaccio-credentials.txt. No default or shared login ships in the image
  • cloudimg's support team on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours

Verdaccio sign-in

Prerequisites

An active Azure subscription, an SSH key pair, and a VNet plus subnet in the target region. Standard_B2s (2 vCPU / 4 GiB RAM) is a good starting point for a team's registry; choose a larger size for many concurrent installs, and a larger data disk for a big package cache. NSG inbound: allow 22/tcp from your management network and 443/tcp (HTTPS) plus 80/tcp (which redirects to HTTPS) from your developers and build agents.

Step 1 — Deploy from the Azure Marketplace

Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Verdaccio by cloudimg, and select Create. On Basics pick your subscription, resource group, region and size; under Administrator account choose SSH public key and paste your key; under Inbound port rules allow SSH (22), HTTP (80) and HTTPS (443). Keep the image's data disk on the Disks tab: it holds your packages and accounts. Then Review + create and Create.

Step 2 — Deploy from the Azure CLI

# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn cloudimg1647283583153:verdaccio-ubuntu-26-04:default:latest

az vm create \
  --resource-group <your-rg> \
  --name verdaccio \
  --image cloudimg1647283583153:verdaccio-ubuntu-26-04:default:latest \
  --size Standard_B2s \
  --admin-username azureuser \
  --generate-ssh-keys \
  --public-ip-sku Standard

Open HTTPS (and HTTP, which redirects) to reach the registry:

az vm open-port --resource-group <your-rg> --name verdaccio --port 443 --priority 900
az vm open-port --resource-group <your-rg> --name verdaccio --port 80  --priority 910

Step 3 — Connect to your VM

ssh azureuser@<vm-public-ip>

The address is on the VM's Overview page in the portal, or from the CLI with az vm show -d -g <your-rg> -n verdaccio --query publicIps -o tsv.

Step 4 — Confirm the services are running

Verdaccio and nginx should both report active. Plain HTTP answers the /health check and redirects everything else to HTTPS, and Verdaccio answers its ping through nginx over TLS, checked against the VM's own certificate. Verdaccio (4873) listens on loopback only; only nginx faces the network:

systemctl is-active verdaccio nginx
curl -s -o /dev/null -w 'health         -> %{http_code}\n' http://127.0.0.1/health
curl -s -o /dev/null -w 'http redirect  -> %{http_code} %{redirect_url}\n' http://127.0.0.1/
curl -s --cacert /etc/nginx/ssl/verdaccio.crt -w '  <- https ping\n' https://127.0.0.1/-/ping
sudo ss -tln | grep -E ':(80|443|4873) ' | awk '{print $4}'

Expected output:

active
active
health         -> 200
http redirect  -> 301 https://127.0.0.1/
{}
  <- https ping
127.0.0.1:4873
0.0.0.0:443
0.0.0.0:80
[::]:443
[::]:80

Service status, health and listeners

Step 5 — Retrieve your admin password

On the first boot of every VM, verdaccio-firstboot.service makes the admin account with a random password unique to that VM (stored as a bcrypt hash), records the VM's address and writes the sign-in details to a root-only file. nginx makes the VM's own self-signed certificate before it first starts. No shared or default credentials ship in the image.

sudo cat /root/verdaccio-credentials.txt

The file (mode 0600, root only) holds the registry URL, the username (admin), the password and the certificate's path:

# Verdaccio 7.1 on Ubuntu 26.04 LTS - made on this VM's first boot by verdaccio-firstboot.service.
# This password is unique to this VM. Store it somewhere safe.

verdaccio.url=https://<VM address>/
verdaccio.admin.user=admin
verdaccio.admin.pass=<VERDACCIO_ADMIN_PASSWORD>
verdaccio.certificate=/etc/nginx/ssl/verdaccio.crt

# Web UI and npm registry: https://<VM address>/ (port 80 redirects there). The certificate is this VM's own,
# self-signed, so a browser warns once. Copy /etc/nginx/ssl/verdaccio.crt to your computer, then:
#   npm config set cafile <path to>/verdaccio.crt --location project
#   npm login --registry https://<VM address>/      (username admin, the password above)
# Sign-up is closed: npm adduser cannot make new accounts. Guide:
# https://www.cloudimg.co.uk/guides/verdaccio-on-ubuntu-26-04-azure/

Per-VM credentials, root-only and masked

You can prove the sign-in round trip from the VM's own shell. This reads the password from the credentials file into a variable (never onto the command line) and signs in through Verdaccio's web sign-in route over HTTPS (a good sign-in answers 200), then shows a wrong password is refused (401):

PASS=$(sudo sed -n 's/^verdaccio\.admin\.pass=//p' /root/verdaccio-credentials.txt)
jq -cn --arg p "$PASS" '{username:"admin",password:$p}' | curl -s --cacert /etc/nginx/ssl/verdaccio.crt -o /dev/null -w 'web sign-in, right password -> %{http_code}\n' -H 'Content-Type: application/json' --data-binary @- https://127.0.0.1/-/verdaccio/sec/login
curl -s --cacert /etc/nginx/ssl/verdaccio.crt -o /dev/null -w 'web sign-in, wrong password -> %{http_code}\n' -H 'Content-Type: application/json' --data-binary '{"username":"admin","password":"wrong-99"}' https://127.0.0.1/-/verdaccio/sec/login
unset PASS

Expected output:

web sign-in, right password -> 200
web sign-in, wrong password -> 401

Step 6 — Sign in to the web UI

Browse to https://<vm-public-ip>/. The certificate is the VM's own self-signed one, so the browser warns once: continue past it, or install your own certificate (see Your own domain and certificate). Until you sign in, the registry shows no packages at all. Select LOGIN in the top right and sign in as admin with the password from Step 5.

Once signed in you see every package on the registry, with its description, keywords, latest version, author and licence:

Private packages after sign-in

Select a package to read its README, with the install command for npm, Yarn, pnpm and Bun and the .npmrc line for its scope:

A package's README and install commands

The VERSIONS tab lists every published version and its dist-tags; DEPENDENCIES and UPLINKS show what the package needs and where it came from:

A package's versions

Step 7 — Point npm at your registry

On your own computer, copy the VM's certificate so npm can verify the registry, tell npm to use it, and sign in with npm login (username admin, the password from Step 5). npm saves a token for the registry in your ~/.npmrc; your password is not stored:

scp azureuser@<vm-public-ip>:/etc/nginx/ssl/verdaccio.crt ~/verdaccio.crt
npm config set cafile ~/verdaccio.crt
npm config set registry https://<vm-public-ip>/
npm login --registry https://<vm-public-ip>/
npm whoami

npm whoami prints admin. From then on npm install reads through your registry: your private packages come from it, and every public package is fetched from npmjs.com once and cached on the VM. To send only one scope to the registry and leave everything else on npmjs.com, set npm config set @acme:registry https://<vm-public-ip>/ instead of registry.

pnpm, Yarn and Bun read the same .npmrc settings. For a build agent or CI job, see Tokens for build agents.

Step 8 — Publish and install a private package

This runs the whole flow on the VM itself, as a build agent would: it signs in through npm's login route to get a token (with the password kept off the command line), points a throwaway npm configuration at the registry, publishes @acme/hello, installs it back next to a public package fetched through the proxy, then unpublishes it and cleans up:

PASS=$(sudo sed -n 's/^verdaccio\.admin\.pass=//p' /root/verdaccio-credentials.txt)
CRT=/etc/nginx/ssl/verdaccio.crt
TOKEN=$(jq -cn --arg p "$PASS" '{name:"admin",password:$p}' | curl -s --cacert $CRT -K <(printf 'user = "admin:%s"\n' "$PASS") -X PUT -H 'Content-Type: application/json' --data-binary @- https://127.0.0.1/-/user/org.couchdb.user:admin | jq -r .token)
unset PASS
W=$(mktemp -d) && cd "$W"
printf 'registry=https://127.0.0.1/\ncafile=%s\n//127.0.0.1/:_authToken=%s\n' "$CRT" "$TOKEN" > npmrc && chmod 600 npmrc
export npm_config_userconfig="$W/npmrc" npm_config_cache="$W/cache" npm_config_update_notifier=false npm_config_fund=false npm_config_audit=false
npm whoami
mkdir hello && cd hello
printf '%s\n' '{"name":"@acme/hello","version":"1.0.0","main":"index.js","license":"MIT"}' > package.json
echo 'module.exports = () => "hello from Verdaccio";' > index.js
npm publish 2>&1 | grep -E '^\+'
npm view @acme/hello version dist.tarball
cd .. && mkdir app && cd app && npm init -y > /dev/null
npm install @acme/hello is-number 2>&1 | grep -E '^added'
node -e 'console.log(require("@acme/hello")())'
npm unpublish --force @acme/hello 2>&1 | grep -E '^-'
cd / && rm -rf "$W" && unset TOKEN npm_config_userconfig npm_config_cache

Expected output:

admin
+ @acme/hello@1.0.0
version = '1.0.0'
dist.tarball = 'https://127.0.0.1/@acme/hello/-/hello-1.0.0.tgz'
added 2 packages in 836ms
hello from Verdaccio
- @acme/hello

npm publish and install through the registry

Step 9 — Confirm the version, the data disk and the access rules

node -p "require('$(npm root -g)/verdaccio/package.json').version"; node --version
findmnt -no SOURCE,TARGET,FSTYPE /var/lib/verdaccio
sudo grep -E '^\s+(max_users|access|publish):' /var/lib/verdaccio/config.yaml
curl -s --cacert /etc/nginx/ssl/verdaccio.crt -o /dev/null -w 'package read, not signed in -> %{http_code}\n' https://127.0.0.1/lodash
curl -s --cacert /etc/nginx/ssl/verdaccio.crt -X PUT -H 'Content-Type: application/json' --data-binary '{"name":"newuser","password":"Some-password-123"}' https://127.0.0.1/-/user/org.couchdb.user:newuser; echo

Expected output (the data disk's device name, /dev/sdc here, can differ on your VM): the versions, the data disk, sign-up closed (max_users: -1) and every package behind a sign-in, an anonymous read refused with 401, and a sign-up refused with 409:

7.1.3
v24.23.0
/dev/sdc /var/lib/verdaccio ext4
    max_users: -1
    access: $authenticated
    publish: $authenticated
    access: $authenticated
    publish: $authenticated
package read, not signed in -> 401
{
  "error": "user registration disabled"
}

Version, data disk and access rules

Adding accounts

Sign-up is closed, so npm adduser cannot make accounts. Add one on the VM with htpasswd (it asks for the new password twice and stores a bcrypt hash), then restart Verdaccio:

sudo htpasswd -B -C 10 /var/lib/verdaccio/htpasswd alice
sudo systemctl restart verdaccio

The new account signs in with npm login and in the web UI straight away. Remove one with sudo htpasswd -D /var/lib/verdaccio/htpasswd alice. An account changes its own password with npm profile set password.

To give accounts different rights, edit the packages: section of /var/lib/verdaccio/config.yaml (for example publish: admin on '@acme/*' so only admin publishes there, while every signed-in account can read), then sudo systemctl restart verdaccio. Verdaccio's packages documentation has the rules.

Tokens for build agents

A build agent or CI job needs a token, not a password. Sign in once as the account the job should use, from any machine that trusts the certificate, and keep the token it prints in your CI's secret store:

npm login --registry https://<vm-public-ip>/
npm token create --registry https://<vm-public-ip>/

The job then writes //<vm-public-ip>/:_authToken=${NPM_TOKEN} into its .npmrc. npm token list and npm token revoke <id> manage them.

Server components

Component Version Runs as Listens on
Verdaccio 7.1.3 (npm) verdaccio (verdaccio.service) 127.0.0.1:4873
Node.js and npm 24 LTS and 11 (NodeSource)
nginx 1.28 (Ubuntu archive) nginx.service :80 (health check and redirect), :443 (HTTPS)
Ubuntu 26.04 LTS

Filesystem layout

Path What it holds
/ The OS disk (about 28 GB usable): Ubuntu, Node.js, nginx and the Verdaccio program files
/usr/lib/node_modules/verdaccio Verdaccio 7.1.3, installed globally with npm
/var/lib/verdaccio The 20 GiB data disk
/var/lib/verdaccio/config.yaml Verdaccio's configuration
/var/lib/verdaccio/htpasswd The account database (bcrypt hashes)
/var/lib/verdaccio/storage Published packages, the npmjs cache, and Verdaccio's token-signing secret (.verdaccio-db.json)
/etc/nginx/sites-available/cloudimg-verdaccio The nginx site
/etc/nginx/ssl/verdaccio.crt, verdaccio.key The TLS certificate and key (the key is root-only)
/root/verdaccio-credentials.txt The per-VM admin sign-in (root-only)
/mnt The Azure temporary disk: lost on deallocation, never for data

First-boot service and security model

The image ships with no accounts, no token-signing secret and no TLS key: they are all made on your VM. verdaccio-firstboot.service runs before nginx and Verdaccio, makes the admin account with a per-VM password, writes the credentials file and leaves a sentinel so it runs exactly once. nginx makes a self-signed certificate for the VM's address before it first starts. Verdaccio makes its own token-signing secret on the data disk the first time it starts, so tokens from one VM never work on another.

systemctl status verdaccio-firstboot.service --no-pager | head -3
echo | openssl s_client -connect 127.0.0.1:443 2>/dev/null | openssl x509 -noout -subject -ext subjectAltName
sudo stat -c '%a %U:%G %n' /root/verdaccio-credentials.txt /var/lib/verdaccio/htpasswd /etc/nginx/ssl/verdaccio.key

Expected output: the service active (exited) (it disables itself once it has run), a certificate made for this VM's address, and the secrets readable only by their owners:

● verdaccio-firstboot.service - Verdaccio first-boot initialisation (this VM's admin password)
     Loaded: loaded (/etc/systemd/system/verdaccio-firstboot.service; disabled; preset: enabled)
     Active: active (exited) since ...
subject=CN=<VM address>
X509v3 Subject Alternative Name: 
    IP Address:<VM address>, IP Address:<private IP>, DNS:localhost, IP Address:127.0.0.1
600 root:root /root/verdaccio-credentials.txt
640 verdaccio:verdaccio /var/lib/verdaccio/htpasswd
600 root:root /etc/nginx/ssl/verdaccio.key

Managing the services

sudo systemctl status verdaccio --no-pager | head -3
● verdaccio.service - Verdaccio private npm registry
     Loaded: loaded (/etc/systemd/system/verdaccio.service; enabled; preset: enabled)
     Active: active (running) since ...

Restart Verdaccio after a configuration change with sudo systemctl restart verdaccio, and nginx with sudo systemctl reload nginx. Verdaccio's log is in journalctl -u verdaccio; nginx's are in /var/log/nginx/.

The largest package Verdaccio accepts is its max_body_size, which is Verdaccio's default of 10 MB until you add a line such as max_body_size: 100mb to config.yaml and restart it. nginx already accepts uploads of up to 1 GB (client_max_body_size in its site file).

Your own domain and certificate

Point a DNS record (for example npm.example.com) at the VM's public address, then move the self-signed certificate and the credentials file to the name in one step:

sudo cloudimg-set-public-address npm.example.com

Run it with no argument to go back to the VM's public IP, and again whenever the VM's address changes. For a certificate every client trusts without a cafile, install one from your CA over the self-signed pair. With Let's Encrypt, once DNS points at the VM and port 80 is open to the internet, certbot's standalone mode briefly stops nginx to answer the challenge on port 80, copies the certificate into place, and saves the same steps for its automatic renewals:

sudo apt-get update && sudo apt-get install -y certbot
sudo certbot certonly --standalone -d npm.example.com \
  --pre-hook 'systemctl stop nginx' --post-hook 'systemctl start nginx' \
  --deploy-hook 'install -m 0644 "$RENEWED_LINEAGE/fullchain.pem" /etc/nginx/ssl/verdaccio.crt && install -m 0600 "$RENEWED_LINEAGE/privkey.pem" /etc/nginx/ssl/verdaccio.key'

A certificate you install yourself is never replaced by the image's tools. With a trusted certificate, developers drop the cafile setting.

Backup and maintenance

Everything that changes lives on the data disk at /var/lib/verdaccio: the configuration, the accounts and the packages. Snapshot that disk from the Azure portal for a point-in-time copy, or archive it:

sudo tar -C /var/lib/verdaccio -czf /var/backups/verdaccio-$(date +%F).tar.gz config.yaml htpasswd storage

The npmjs cache can be large and is fetched again when missing, so a backup of your own packages alone is enough to restore your registry. Keep the OS current with sudo apt-get update && sudo apt-get upgrade (Node.js updates within version 24 come from NodeSource's repository the same way); the image ships with unattended security updates enabled. Read Verdaccio's release notes and back up before moving to a new Verdaccio version.

Troubleshooting

  • The browser shows a certificate warning, or npm says unable to verify the first certificate or self-signed certificate. Expected with the self-signed certificate: set npm's cafile (Step 7), or install your own certificate (above).
  • npm says E401 or Unable to authenticate. Run npm login --registry https://<vm-public-ip>/ again: every package needs a signed-in account.
  • npm adduser fails with 409 user registration disabled. Expected: sign-up is closed. Add the account on the VM (see Adding accounts).
  • The web UI shows no packages. Sign in first: anonymous visitors see nothing.
  • The credentials file says first boot has not run yet. Wait a minute after the VM starts, then read it again; journalctl -u verdaccio-firstboot shows each step.
  • Verdaccio does not start. journalctl -u verdaccio -n 50 names the reason, often a YAML error in config.yaml; df -h /var/lib/verdaccio shows whether the data disk is full or missing.

Security recommendations

  • Restrict 22/tcp in the NSG to your management network, and expose 443/tcp (and 80/tcp for the redirect) only to your developers and build agents.
  • Keep the admin password somewhere safe, then delete /root/verdaccio-credentials.txt if you no longer need it.
  • Give each person and each build agent its own account or token, so you can remove one without touching the others.
  • Install a certificate on your own domain before you roll the registry out to a team.
  • Leave sign-up closed unless you mean anyone who can reach the registry to create an account.

Support

cloudimg's support team is on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours, for deployment, accounts and access rules, uplinks and scoped registries, CI and build agent setup, your own domain and certificates, storage growth and upgrades. Email support@cloudimg.co.uk.