RPM-based enterprise Linux hosts often lag the upstream Node.js release train because distribution repositories favor supported module streams. The NodeSource RPM repository gives CentOS Stream and Red Hat Enterprise Linux-compatible systems a package-managed path to the current Node.js release line when a project needs newer runtime features than the distro channel provides.
NodeSource uses a setup script to add its RPM repository and signing key, then dnf installs the packaged nodejs build like any other system package. Keeping the runtime in a package repository means future patch updates can arrive through normal dnf update maintenance instead of manual tarball replacement.
For production workloads, the RHEL-supported module stream or an LTS channel is usually the steadier default; the Current channel moves faster. A completed install leaves the NodeSource repository enabled, reports working node and npm versions, and runs a small JavaScript expression through the installed runtime.
Steps to install latest Node.js on CentOS or Red Hat Enterprise Linux:
- Open a terminal with sudo privileges.
- Install curl and the certificate bundle used to fetch the repository setup script.
$ sudo dnf install --assumeyes curl ca-certificates
- Download the NodeSource Current RPM setup script.
$ curl -fsSL https://rpm.nodesource.com/setup_current.x -o nodesource_setup.sh
Use setup_lts.x instead when the host should track the latest Node.js LTS line rather than the faster Current line.
- Add the NodeSource repository.
$ sudo bash nodesource_setup.sh Repository is configured and updated. Run 'dnf install nodejs -y' to complete the installation.
- Install Node.js from the NodeSource repository.
$ sudo dnf install --assumeyes nodejs Dependencies resolved. ##### snipped ##### Installed: nodejs-2:26.3.1-1nodesource Complete!
The nodejs package includes npm, so a separate npm package is not needed for the standard NodeSource install.
- Check the installed Node.js version.
$ node --version v26.3.1
The exact version changes as NodeSource updates the Current RPM channel.
- Check the included npm version.
$ npm --version 11.16.0
- Run a JavaScript smoke test with the installed runtime.
$ node -p 'process.version+" on "+process.platform' v26.3.1 on linux
- Remove the downloaded setup script.
$ rm --force nodesource_setup.sh
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.