Install latest Node.js on Ubuntu 26.04 with a signed NodeSource APT repository and get both node and npm ready in about ten minutes. This guide targets Ubuntu 26.04 LTS, code-named Resolute Raccoon, and finishes with a private HTTP request that proves the runtime works.
Prerequisites
- A 64-bit Ubuntu 26.04 LTS server with at least 1 GB of RAM and 2 GB of free disk space for Node.js, npm, and a small application.
- SSH access as
root, or a normal account that can run commands withsudo. - Outbound HTTPS access to Ubuntu package mirrors and
deb.nodesource.com. - No domain is needed for installation or for the localhost-only test in this guide.
- A VPSLake Linux VPS if you need a root-access server for Node.js projects.
The commands assume a non-root SSH account and use sudo. If your shell is already root, remove sudo from each command. NodeSource calls its feed an APT repository; although many tutorials say “PPA,” it is not a Launchpad PPA.
Step 1: Check Ubuntu 26.04 and prepare APT
Confirming the release and CPU architecture first prevents you from adding a repository to the wrong operating system.
. /etc/os-release
printf 'ID=%s\nVERSION_ID=%s\nVERSION_CODENAME=%s\n' "$ID" "$VERSION_ID" "$VERSION_CODENAME"
dpkg --print-architecture
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
The release check should identify Ubuntu 26.04 as resolute. NodeSource’s Debian packages support the common amd64 and arm64 server architectures.
ID=ubuntu
VERSION_ID="26.04"
VERSION_CODENAME=resolute
amd64
If the output shows another release, stop and use that release’s instructions. Do not change VERSION_CODENAME by hand or continue after an APT 404 error.
Step 2: Add the NodeSource current-release repository
The current-release setup script installs NodeSource’s signing key, writes an APT source file, and selects the current Node.js major instead of relying on Ubuntu’s often older archive package.
Download the script first, run the local copy with sudo, and remove it after the repository has been configured:
curl -fsSL https://deb.nodesource.com/setup_current.x -o /tmp/nodesource-setup.sh
sudo -E bash /tmp/nodesource-setup.sh
rm -f /tmp/nodesource-setup.sh
At the time of writing, the current selector points to Node.js 26.x. The major and patch version can change, so inspect APT’s candidate rather than copying a version number from an example.
sudo grep -E '^(Types|URIs|Suites|Components|Architectures|Signed-By):' /etc/apt/sources.list.d/nodesource.sources
apt-cache policy nodejs | sed -n '1,9p'
Expected output contains the NodeSource URI, the intentional nodistro suite, and a non-empty candidate:
URIs: https://deb.nodesource.com/node_26.x
Suites: nodistro
Components: main
Architectures: amd64
Signed-By: /usr/share/keyrings/nodesource.gpg
Candidate: 26.x.y-1nodesource1
The NodeSource Debian and Ubuntu instructions describe the supported repository setup and architectures. Do not replace the nodistro value with resolute; the feed intentionally uses its own distribution-neutral suite.
Step 3: Install Node.js and npm
NodeSource’s nodejs package includes npm, so one APT installation provides the runtime, package manager, and the usual command-line tools.
sudo apt-get install -y nodejs
node --version
npm --version
command -v node
command -v npm
The exact patch and npm versions will vary. A successful installation looks like this:
v26.x.y
11.x.y
/usr/bin/node
/usr/bin/npm
If an older nodejs package was already installed, APT should prefer the NodeSource candidate. Compare the installed version with apt-cache policy nodejs before troubleshooting further.
Step 4: Run a localhost HTTP smoke test
This short test exercises Node.js’s built-in HTTP module while binding only to 127.0.0.1, so it does not expose a new public port on your VPS.
node -e 'require("node:http").createServer((request, response) => response.end("Node.js is working on Ubuntu 26.04\\n")).listen(3000, "127.0.0.1")' >/tmp/node-resolute-test.log 2>&1 &
NODE_PID=$!
sleep 1
curl --fail --silent http://127.0.0.1:3000
kill "$NODE_PID"
wait "$NODE_PID" 2>/dev/null || true
The response should be:
Node.js is working on Ubuntu 26.04
The process is stopped at the end of the block. For a real public application, run it as a dedicated non-root user behind a TLS-enabled reverse proxy and open only the ports that service requires.
Verify the Node.js installation
Use these checks to verify the runtime, npm, architecture, a built-in module, and the package origin in one pass:
node --version
npm --version
node -p 'process.platform + " " + process.arch'
node -e 'console.log(typeof require("node:fs").readFileSync === "function" ? "Built-in module check passed" : "Built-in module check failed")'
apt-cache policy nodejs | sed -n '1,8p'
You should see a v26 version from the current channel, a numeric npm version, linux amd64 or linux arm64, the passed module check, and a candidate from deb.nodesource.com. The official Node.js API documentation is the reference for runtime modules and APIs.
Troubleshooting
E: Failed to fetch ... resolute ... 404 Not Found
The server is using an invalid or no-longer-available Ubuntu mirror, or it is not actually running 26.04. Recheck /etc/os-release, inspect the configured Ubuntu sources, and make sure the system is fully upgraded from supported mirrors. Never solve this by changing resolute to another codename or disabling APT signature checks.
grep -RhoE '^[[:space:]]*deb[[:space:]]+[^ ]+[[:space:]]+[^ ]+' /etc/apt/sources.list /etc/apt/sources.list.d 2>/dev/null
sudo apt-get update
node --version shows an older major
The setup script may not have completed, or another package source is supplying the candidate. Clear Bash’s cached command path, inspect both versions, and reinstall the NodeSource candidate:
hash -r
command -v node
apt-cache policy nodejs
sudo apt-get update
sudo apt-get install --only-upgrade -y nodejs
node --version
The policy output should include https://deb.nodesource.com/node_26.x. If it does not, rerun Step 2 and read the setup script’s first error instead of installing blindly.
Could not resolve host: deb.nodesource.com
This indicates a DNS or outbound-network problem, not a missing Node.js package. Test name resolution and HTTPS independently:
getent hosts deb.nodesource.com
curl --head --fail https://deb.nodesource.com
An address from getent and an HTTPS response show that the repository is reachable. If either command fails, correct the VPS resolver, route, or provider egress policy, then rerun Step 2.
npm ERR! EACCES during a global install
The APT package owns the system-wide npm prefix, so an ordinary user cannot write global packages there. Keep application dependencies inside the project directory instead:
mkdir -p ~/YOUR_APP
cd ~/YOUR_APP
npm init -y
npm install YOUR_PACKAGE
Replace YOUR_APP and YOUR_PACKAGE with your own values. This keeps ownership with your account; use a version manager only when you genuinely need multiple Node.js majors.
Hardening and next steps
- Create a dedicated service account for production applications and supervise the process with systemd rather than leaving it attached to an SSH session.
- Keep
package-lock.jsonunder version control, store secrets outside the repository, and reviewnpm auditfindings before deploying dependency updates. - If the application is public, allow only SSH, HTTP, and HTTPS in UFW. The VPSLake UFW firewall generator can help draft a narrow ruleset for review.
- Choose the LTS selector for a long-lived production service when your dependencies do not require current-release features: use
setup_lts.xin Step 2 and verify the resulting major before deployment.
FAQ
Is NodeSource a PPA for Ubuntu 26.04?
No. NodeSource publishes a signed third-party APT repository, while a conventional PPA is hosted through Launchpad. The installation commands are similar, but the source file, keyring, and package origin belong to NodeSource.
Does Node.js 26 work on Ubuntu 26.04?
The current NodeSource Debian setup script selects the Node.js 26.x repository and supports Ubuntu’s Debian-based package flow. The command above deliberately checks the APT candidate first, because patch versions and repository contents change over time.
Should a production server use Current or LTS Node.js?
Current is appropriate when you need newly released runtime features and have tested your dependencies against that major. LTS is usually the steadier choice for an application that will be maintained for a longer period, so select it before installing if that is your priority.
Can I install Node.js without opening port 3000?
Yes. The smoke test listens on 127.0.0.1, which is reachable from the server itself but not from the public network. A production service can also bind to localhost and let a reverse proxy handle external HTTPS traffic.