In this tutorial, you will install Node.js 24 LTS and npm on Ubuntu 24.04, verify the runtime, install build tools for native modules, run a localhost-only HTTP test, and create a small Express application.
Node.js is a JavaScript runtime used for APIs, web applications, command-line tools, automation, and server-side frameworks. For production workloads, the Node.js project recommends using an LTS release. As of August 14, 2026, Node.js 24 is an LTS line while Node.js 26 is the Current line.
Raff Technologies supports 3,000+ customers and 15,000+ VMs. A Raff Linux VM provides Ubuntu, root access, NVMe storage, 3 Gbps unmetered VM traffic, snapshots, backups, firewall controls, and the networking foundation for Node.js workloads.
The original Node.js 24 workflow was tested on a Raff Ubuntu 24.04 VM with 1 vCPU and 2 GB RAM. This revision refreshes the NodeSource, Node.js LTS, and nvm guidance against current project documentation dated August 14, 2026.
Prerequisites:
- A Raff Ubuntu 24.04 VM
- SSH access with a non-root user that has sudo privileges
- At least 2 GB RAM for the tested setup
- Internet access from the VM for APT and npm downloads
Installation choice: This tutorial uses NodeSource for the primary system-wide Node.js 24 installation. Use nvm instead when one user needs to switch between multiple Node.js versions. Do not install both methods unless you understand which
nodebinary your shell and services will use.
Step 1 — Prepare Ubuntu 24.04
Update the package index and install the tools required to add the NodeSource repository:
sudo apt update sudo apt install -y ca-certificates curl gnupg
Confirm the Ubuntu release:
lsb_release -ds
Expected output includes:
Ubuntu 24.04 LTS
Check whether an older Node.js runtime is already installed:
node --version 2>/dev/null || echo "Node.js is not installed" npm --version 2>/dev/null || echo "npm is not installed"
If an existing application depends on the installed version, do not replace it until you have reviewed that application’s compatibility and rollback plan.
Verification is complete when Ubuntu 24.04 is confirmed and you know whether an existing Node.js installation is present.
Step 2 — Add the NodeSource repository for Node.js 24
NodeSource publishes Node.js 24 packages for Ubuntu 24.04. Download the setup script to a file instead of piping it directly into a privileged shell:
curl -fsSL https://deb.nodesource.com/setup_24.x -o /tmp/nodesource_setup.sh
Inspect the downloaded script before running it:
sed -n '1,160p' /tmp/nodesource_setup.sh
Run the repository setup:
sudo -E bash /tmp/nodesource_setup.sh
Refresh APT metadata:
sudo apt update
Verify that APT now sees a NodeSource candidate:
apt-cache policy nodejs | sed -n '1,16p'
Expected output includes a Candidate: entry from the NodeSource repository.
NodeSource’s current distribution matrix lists Ubuntu 24.04 (noble) as supported for Node.js 24.
Verification is complete when apt-cache policy nodejs shows a NodeSource candidate for the Node.js 24 line.
Step 3 — Install Node.js 24 LTS and npm
Install the Node.js package:
sudo apt install -y nodejs
Verify Node.js and npm:
node --version npm --version
Expected version pattern:
v24.x.x 11.x.x
As of August 14, 2026, the current Node.js 24 LTS release is v24.18.1. Your patch version may be newer when you run the tutorial.
Confirm which binaries are active:
command -v node command -v npm
For the NodeSource system-wide installation, the paths should normally resolve under /usr/bin/.
Verification is complete when node --version reports v24.x.x, npm runs successfully, and the active binaries are the system-wide installation you intended to use.
Step 4 — Install build tools for native npm modules
Some npm dependencies include native addons that need a compiler toolchain when a compatible prebuilt binary is unavailable.
Install Ubuntu’s build tools:
sudo apt install -y build-essential
Verify the compiler and build utility:
gcc --version | head -n 1 make --version | head -n 1
Expected output includes a GCC version and GNU Make version.
Verification is complete when both gcc and make are available.
Step 5 — Verify Node.js with a localhost-only HTTP server
Create a test project directory:
mkdir -p ~/hello-node cd ~/hello-node
Create a small HTTP server:
cat > server.js <<'EOF' const http = require('node:http'); const host = '127.0.0.1'; const port = 3000; const server = http.createServer((req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); res.end('Hello from Node.js on Raff!\n'); }); server.listen(port, host, () => { console.log(`Server running at http://${host}:${port}/`); }); EOF
Start the server:
node server.js
In a second SSH session, test it locally:
curl -i http://127.0.0.1:3000
Expected output includes:
HTTP/1.1 200 OK Hello from Node.js on Raff!
Confirm that the test server is not listening publicly:
ss -lntp | grep ':3000'
Expected listening address:
127.0.0.1:3000
Stop the foreground server with Ctrl+C after verification.
Do not open port 3000 through UFW for this installation test. A production Node.js application should normally stay behind a reverse proxy or another controlled ingress path.
Verification is complete when the local HTTP request returns 200 OK and Node.js listens only on 127.0.0.1:3000.
Step 6 — Initialize npm and verify an Express dependency
Initialize a package manifest:
cd ~/hello-node npm init -y
Install Express locally in the project:
npm install express
Verify that npm recorded the dependency:
npm ls express
Create a small Express application:
cat > app.js <<'EOF' const express = require('express'); const app = express(); const host = '127.0.0.1'; const port = 3000; app.get('/', (req, res) => { res.type('text/plain').send('Express is running on Node.js 24\n'); }); app.get('/health', (req, res) => { res.status(200).json({ status: 'ok' }); }); app.listen(port, host, () => { console.log(`Express listening on http://${host}:${port}`); }); EOF
Run the application:
node app.js
In a second SSH session, verify both routes:
curl http://127.0.0.1:3000/ curl http://127.0.0.1:3000/health
Expected output:
Express is running on Node.js 24 {"status":"ok"}
Stop the foreground process with Ctrl+C.
Verification is complete when npm ls express succeeds and both Express routes return the expected response.
Step 7 — Verify the complete Node.js installation
Run the final checks:
node --version npm --version command -v node command -v npm gcc --version | head -n 1 cd ~/hello-node npm ls express node -e "console.log(process.version, process.platform, process.arch)"
Expected state:
Node.js reports v24.x.x npm reports 11.x.x node and npm are available system-wide GCC is installed Express is present in the project Node.js reports linux and the VM architecture
The installation is complete when Node.js 24 LTS, npm, the native-module build toolchain, the local HTTP test, and the Express dependency test all succeed.
