AlmaLinux

Install Node.js 24 LTS on Rocky Linux 10 / AlmaLinux 10

Rocky Linux 10 bundles Node.js 22 in AppStream, which covers most use cases. But if you need npm 11’s faster dependency resolution, V8 13.6 for Float16Array support, or the promoted permission model, Node.js 24 Krypton is the current Active LTS and the right move.

Original content from computingforgeeks.com - post 164324

This guide walks through three ways to install Node.js 24 on Rocky Linux 10, AlmaLinux 10, and RHEL 10, with real command output from a test VM. After installation, we build a working Express.js API, run the built-in test runner, configure a systemd service for production, and cover SELinux and firewalld configuration. If you run Ubuntu or Debian, see the Ubuntu 24.04/22.04 guide or the Debian 13/12 guide instead.

What You Need

  • Rocky Linux 10, AlmaLinux 10, or RHEL 10 with sudo access
  • About 80 MB disk space for Node.js and npm
  • Port 3000/tcp open in firewalld if running web applications

Check Your Current Node.js Version

Before installing, check whether Node.js is already on the system:

node -v 2>/dev/null || echo "Node.js not installed"
npm -v 2>/dev/null || echo "npm not installed"

Rocky Linux 10 ships Node.js 22 in the AppStream repository as a module stream. That version works fine for many projects, but it does not include Node.js 24. The methods below get you the latest LTS release.

Install Node.js 24 on Rocky Linux 10

Three methods are available. Pick one based on your use case: NodeSource for production servers with automatic dnf updates, NVM for development machines that need multiple Node.js versions, or the binary tarball for air-gapped or custom setups.

Method 1: NodeSource Repository (Recommended for Production)

NodeSource tracks upstream Node.js releases and packages them as RPMs that integrate with dnf. Updates arrive within hours of each Node.js release.

If the AppStream nodejs module is enabled, disable it first so it does not conflict with NodeSource:

sudo dnf module disable -y nodejs

Add the NodeSource repository for Node.js 24:

curl -fsSL https://rpm.nodesource.com/setup_24.x | sudo bash -

Install Node.js (npm and npx are bundled):

sudo dnf install -y nodejs

Verify the installation:

node -v
npm -v

Confirmed output from a Rocky Linux 10 VM:

v24.14.0
11.9.0

Check the V8 engine version and platform:

node -e "console.log('Platform:', process.platform, process.arch); console.log('V8:', process.versions.v8)"

V8 13.6 confirmed on the test VM:

Platform: linux x64
V8: 13.6.233.17-node.41

Method 2: NVM (Best for Development)

NVM installs Node.js in your home directory and lets you switch between multiple Node.js versions per project. No sudo required for npm global installs.

Install NVM (auto-detects the latest release from GitHub):

NVM_VER=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | grep tag_name | cut -d \" -f4)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VER}/install.sh | bash

Reload your shell:

source ~/.bashrc

Install Node.js 24 and set it as the default:

nvm install 24
nvm alias default 24
node -v

Switch between versions any time with nvm use 22 or nvm use 24. For production servers, NodeSource is still the better choice because NVM does not provide automatic security updates through dnf.

Method 3: Official Binary Tarball

Download the prebuilt binary directly from nodejs.org. This works on any Linux system regardless of package manager. The version auto-detects from the Node.js download API:

NODE_VER=$(curl -s https://nodejs.org/dist/latest-v24.x/ | grep -oP 'node-v\K[0-9.]+' | head -1)
curl -sLO https://nodejs.org/dist/v${NODE_VER}/node-v${NODE_VER}-linux-x64.tar.xz
sudo tar xJf node-v${NODE_VER}-linux-x64.tar.xz -C /usr/local --strip-components=1
rm node-v${NODE_VER}-linux-x64.tar.xz

Verify:

node -v
npm -v

Install Build Tools for Native Modules

Packages like bcrypt, sharp, and sqlite3 compile native C/C++ addons during npm install. Without the build toolchain, they fail with gyp ERR! errors:

sudo dnf install -y gcc-c++ make

NVM users get this handled automatically when Node.js compiles from source, but NodeSource and tarball installs need it explicitly.

SELinux Configuration

Rocky Linux 10 runs SELinux in enforcing mode. Node.js works with the default policy when running on standard ports. No custom booleans or context changes are needed for a typical Node.js application.

Verify there are no SELinux denials after starting your Node.js application:

sudo ausearch -m avc -ts recent

If the output shows no matches, SELinux is not blocking anything. If you bind Node.js to a non-standard port (anything other than common HTTP ports), you may need to allow it:

sudo semanage port -a -t http_port_t -p tcp 3000

Configure Firewalld

Rocky Linux 10 uses firewalld by default. Open port 3000 for your Node.js application:

sudo firewall-cmd --permanent --add-port=3000/tcp
sudo firewall-cmd --reload

Verify the port is open:

sudo firewall-cmd --list-ports

You should see 3000/tcp in the output. For production deployments behind Nginx or Apache, open port 443/tcp instead and proxy traffic to the Node.js backend.

Build an Express.js API (Demo Project)

A quick demo confirms the full stack works. Initialize a project and install Express:

mkdir -p ~/node-demo && cd ~/node-demo
npm init -y
npm install express

Create the server file:

vi ~/node-demo/server.js

Add the following Express application:

const express = require("express");
const app = express();
const PORT = 3000;

app.get("/", (req, res) => {
  res.json({
    message: "Node.js 24 LTS running on Rocky Linux 10",
    nodeVersion: process.version,
    v8Version: process.versions.v8,
    platform: process.platform,
    arch: process.arch,
    uptime: process.uptime()
  });
});

app.listen(PORT, () => console.log("Server running on port " + PORT));

Start the server:

node ~/node-demo/server.js

From another terminal, hit the API:

curl http://localhost:3000/

Real JSON response from our Rocky Linux 10 test VM:

{
    "message": "Node.js 24 LTS running on Rocky Linux 10",
    "nodeVersion": "v24.14.0",
    "v8Version": "13.6.233.17-node.41",
    "platform": "linux",
    "arch": "x64",
    "uptime": 2.008696158
}

Use the Built-in Test Runner

Node.js 24 ships a production-ready test runner in the node:test module. For projects that don’t need Jest’s mocking framework or Mocha’s plugin ecosystem, it covers the basics without any npm dependencies.

Create a test file:

vi ~/node-demo/test.mjs

Add the following test cases:

import { test } from "node:test";
import assert from "node:assert";

test("math works", () => {
  assert.strictEqual(1 + 1, 2);
});

test("node version is 24", () => {
  assert.ok(process.version.startsWith("v24"));
});

Run the tests:

node --test ~/node-demo/test.mjs

Real output from our Rocky Linux 10 VM:

✔ math works (0.481963ms)
✔ node version is 24 (0.126785ms)
ℹ tests 2
ℹ suites 0
ℹ pass 2
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 39.468755

Run Node.js as a systemd Service

For production deployments, configure systemd to start your Node.js app on boot and restart it on crashes.

Create a dedicated user for the application:

sudo useradd -r -s /sbin/nologin nodeapp

Create the service unit file:

sudo vi /etc/systemd/system/nodeapp.service

Add the following configuration:

[Unit]
Description=Node.js Application
After=network.target

[Service]
Type=simple
User=nodeapp
WorkingDirectory=/opt/myapp
ExecStart=/usr/bin/node server.js
Restart=on-failure
RestartSec=5
Environment=NODE_ENV=production
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

Enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable --now nodeapp

Check the service status:

sudo systemctl status nodeapp

The service should show active (running). View application logs with:

sudo journalctl -u nodeapp -f

For more advanced process management with cluster mode, log rotation, and zero-downtime reloads, look at PM2 process manager.

Upgrade from Node.js 22 to Node.js 24

If you are running Node.js 22 from the AppStream module or an older NodeSource repository, here is how to upgrade to Node.js 24.

Remove the existing Node.js installation and disable the AppStream module if active:

sudo dnf remove -y nodejs
sudo dnf module disable -y nodejs

Add the NodeSource 24.x repository and install:

curl -fsSL https://rpm.nodesource.com/setup_24.x | sudo bash -
sudo dnf install -y nodejs

Verify the upgrade:

node -v
npm -v

After upgrading, rebuild any native modules in your projects:

cd /path/to/your/project
npm rebuild

The NODE_MODULE_VERSION changed from 134 (Node.js 22) to 137 (Node.js 24), so native addons compiled for Node.js 22 will not work without a rebuild.

Node.js 22 vs Node.js 24

ComponentNode.js 22 (Jod)Node.js 24 (Krypton)
StatusMaintenance LTS (until Apr 2027)Active LTS (until Apr 2028)
V8 Engine12.413.6
npm10.x11.9
Test runnerStable (basic)Stable (global setup/teardown, auto subtest)
Permission model--experimental-permission--permission (promoted)
using keywordNot availableExplicit resource management
URLPatternRequires importGlobal (no import needed)
SQLiteExperimentalStable with transactions, aggregates
NODE_MODULE_VERSION134137

If your project is stable on Node.js 22 and you don’t need the new features, staying on 22 through April 2027 is fine. Upgrade when you need npm 11, the V8 13.6 improvements, or when Node.js 22 enters end-of-life.

Install Yarn

Some projects require Yarn. Install Yarn Classic globally:

sudo npm install -g yarn
yarn --version

For Yarn 4.x (Berry), enable Corepack inside your project:

corepack enable
yarn set version stable

Uninstall Node.js

To completely remove Node.js installed via NodeSource:

sudo dnf remove -y nodejs
sudo rm -f /etc/yum.repos.d/nodesource*.repo
sudo dnf clean all

For NVM installations, remove the version and optionally NVM itself:

nvm uninstall 24
rm -rf ~/.nvm

Key Features in Node.js 24

FeatureDetails
V8 Engine13.6 with Float16Array, RegExp.escape(), Error.isError()
npm11.9.0 (faster installs, improved security)
Permission modelPromoted from experimental (--permission flag)
Test runnerStable with global setup/teardown, automatic subtest waiting
using keywordExplicit resource management (like Python’s with)
URLPatternGlobally available without import
Undici 7Improved fetch() with proxy support via NODE_USE_ENV_PROXY
SQLiteBuilt-in with aggregate functions, transactions, timeouts

Node.js Release Schedule

VersionCodenameStatusEnd of Life
Node.js 24KryptonActive LTSApril 2028
Node.js 22JodMaintenance LTSApril 2027
Node.js 20IronEnd of LifeApril 2026
Node.js 18HydrogenEnd of LifeApril 2025

Always use an Active LTS or Maintenance LTS release for production. Odd-numbered releases (23, 25) are Current releases with only 6 months of support.

Troubleshooting

Error: “gyp ERR! build error” when installing npm packages

Install the build toolchain with sudo dnf install -y gcc-c++ make. Packages like bcrypt, sharp, and canvas need gcc, g++, and make to compile native addons.

NodeSource conflicts with AppStream nodejs module

Rocky Linux 10 enables the nodejs module stream in AppStream by default. If dnf installs Node.js 22 instead of 24, disable the module first with sudo dnf module disable -y nodejs, then install from the NodeSource repository.

SELinux blocks Node.js from binding to a port

Check for AVC denials with sudo ausearch -m avc -ts recent. If Node.js cannot bind to port 3000, add it to the allowed HTTP ports: sudo semanage port -a -t http_port_t -p tcp 3000. Standard ports like 80 and 443 are already allowed by default.

Firewalld blocks incoming connections to the Node.js app

Rocky Linux 10 enables firewalld by default. If external clients cannot reach your application, open the port with sudo firewall-cmd --permanent --add-port=3000/tcp && sudo firewall-cmd --reload. Confirm with sudo firewall-cmd --list-ports.

Wrong Node.js version after NodeSource install

The AppStream nodejs module may still be active. Disable it with sudo dnf module disable -y nodejs, remove the old package with sudo dnf remove -y nodejs, then reinstall from NodeSource. Verify with which node to confirm /usr/bin/node points to the NodeSource version.

Error: “EACCES: permission denied” with npm install -g

If you used NVM, never run npm install -g with sudo. NVM installs Node.js in your home directory, so global installs work without root. If you used NodeSource, sudo npm install -g is the correct approach.

Native modules break after upgrading from Node.js 22

Run npm rebuild in your project directory. Node.js 24 uses NODE_MODULE_VERSION 137 (up from 134 in Node.js 22), so all native addons need recompilation.

Error: “MODULE_NOT_FOUND” after Node.js upgrade

Delete node_modules and reinstall dependencies: rm -rf node_modules package-lock.json && npm install. This catches cases where cached modules are incompatible with the new Node.js version.

FAQ

Is Node.js 24 LTS ready for production on Rocky Linux?

Yes. Node.js 24 entered Active LTS in October 2025 and receives full support including bug fixes and security patches through April 2028. The NodeSource RPM packages are tested on RHEL-compatible distributions and work identically on Rocky Linux, AlmaLinux, and RHEL.

Should I use the AppStream module or NodeSource?

The AppStream module provides Node.js 22, which is fine if you don’t need the latest features. NodeSource gives you Node.js 24 with faster updates when new patch releases come out. For production servers that need the latest LTS, NodeSource is the better choice. For environments that prioritize RHEL-certified packages, the AppStream module is more conservative.

Will NodeSource packages work on AlmaLinux and RHEL too?

Yes. Rocky Linux, AlmaLinux, and RHEL 10 are binary-compatible. The same NodeSource RPM repository works on all three without modification. The commands in this guide apply to all RHEL-family distributions.

Should I upgrade from Node.js 22 to 24?

If your project works on Node.js 22, there is no rush. Node.js 22 receives maintenance patches until April 2027. Upgrade when you need npm 11, V8 13.6 features, or the stable permission model.

Can I run multiple Node.js versions on the same server?

Yes. Use NVM to install and switch between versions: nvm install 22, nvm install 24, then nvm use 24 for the version you need. Each version gets its own npm global packages.

Does Node.js 24 need special SELinux policies on Rocky Linux?

No. Node.js works with the default SELinux policy on Rocky Linux 10. The only case where you need a manual policy adjustment is when binding to a non-standard port. Use sudo semanage port -a -t http_port_t -p tcp YOUR_PORT if you run into AVC denials.

Wrapping Up

Node.js 24 LTS is running on your Rocky Linux 10 server with npm 11.9, V8 13.6, and a stable built-in test runner. The same steps work on AlmaLinux 10 and RHEL 10 without modification. For the Ubuntu 24.04/22.04 equivalent, use the DEB variant of NodeSource. For Debian 13/12, the same DEB repository applies. Check the official Node.js 24 release notes for the full list of breaking changes and new APIs.

Related Articles

Storage Install and Configure NFS Server on Rocky Linux 10 / AlmaLinux 10 / RHEL 10 AlmaLinux Installing DirectAdmin on Rocky Linux 8 / AlmaLinux 8 AlmaLinux Install Python 3.11 on Rocky Linux 9 / AlmaLinux 9 AlmaLinux Migrating From CentOS 8 To AlmaLinux 8 Linux

Leave a Comment

Press ESC to close