Node.js runs JavaScript on the server: APIs, real-time apps and build tools. This guide installs Node.js 26 (Active LTS) on Ubuntu 24.04 or 26.04 from the NodeSource repository, then runs an app the production way — as a non-root systemd service that restarts on failure.
Which version should you use?
Production apps should use an LTS line. Even-numbered releases become LTS and receive about 30 months of fixes.
| Version | Released | Status (Nov 2026) | Security fixes until |
|---|---|---|---|
| 26 | 5 May 2026 | Active LTS | 30 April 2029 |
| 24 | 6 May 2025 | Maintenance LTS | 30 April 2028 |
| 22 | 24 April 2024 | Maintenance LTS | 30 April 2027 |
From Node.js 27, the project moves to one major release a year, and every release becomes LTS.
Prerequisites
- A server running Ubuntu 24.04 or 26.04 (22.04 works too).
- A user with
sudorights.
Step 1 — Add the NodeSource repository for Node.js 26
Ubuntu's own nodejs package is usually an older line. NodeSource publishes signed packages for every LTS line. Download the setup script, read it if you like, then run it:
sudo apt update && sudo apt install -y curl
curl -fsSL https://deb.nodesource.com/setup_26.x -o nodesource_setup.sh
less nodesource_setup.sh
sudo -E bash nodesource_setup.shStep 2 — Install Node.js
sudo apt install -y nodejs
node -v
npm -vv26.x.xThe package includes npm. Because the repository is pinned to the 26.x line, apt upgrade installs new 26.x security releases but never jumps to another major version.
Step 3 — Create a user for your app
Never run a web app as root. Create a system user that owns the app and nothing else:
sudo useradd --system --create-home --home-dir /srv/myapp --shell /usr/sbin/nologin myapp
sudo -u myapp git clone https://github.com/you/myapp.git /srv/myapp/app
cd /srv/myapp/app && sudo -u myapp npm ci --omit=devStep 4 — Run it as a systemd service
Create /etc/systemd/system/myapp.service:
[Unit]
Description=My Node.js app
After=network.target
[Service]
User=myapp
WorkingDirectory=/srv/myapp/app
Environment=NODE_ENV=production
Environment=PORT=3000
ExecStart=/usr/bin/node server.js
Restart=on-failure
NoNewPrivileges=true
ProtectSystem=strict
ReadWritePaths=/srv/myapp
[Install]
WantedBy=multi-user.targetsudo systemctl daemon-reload
sudo systemctl enable --now myapp
journalctl -u myapp -fKeep the app on 127.0.0.1:3000 and put a reverse proxy such as nginx in front of it for HTTPS.
Node.js 24 and later can also limit what a process may touch with the permission model, for example node --permission --allow-fs-read=/srv/myapp server.js. Test it with your app before enabling it in production.
Step 5 — Keep it patched
sudo apt update && sudo apt upgrade -y
sudo systemctl restart myapp
npm audit --omit=devUpgrading to a newer major version later
Change the setup script number (for example setup_26.x), run it again, then sudo apt install -y nodejs. Run your test suite on the new version first — major releases remove deprecated APIs.
Conclusion
Node.js 26 is installed on Ubuntu and your app runs as a restricted systemd service. Node.js 26 receives security fixes until 30 April 2029; schedule the upgrade well before that date.