Installing Node.js on CentOS Stream 10

CentOS Stream 10 does not have Node.js available as a module like CentOS 8, so we need to install it using NodeSource. Here’s how you can install Node.js on CentOS Stream 10 in a structured manner.

Adding the NodeSource Repository

Run the following command to add the Node.js 20 LTS repository to your system:

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

Output:

[root@vps ~]# curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -
2025-02-25 17:43:22 - Cleaning up old repositories...
2025-02-25 17:43:22 - Old repositories removed
2025-02-25 17:43:22 - Supported architecture: x86_64
2025-02-25 17:43:22 - Added N|Solid repository for LTS version: 20.x
2025-02-25 17:43:22 - dnf available, updating...
Node.js Packages for Linux RPM based distros -   40 kB/s |  12 kB     00:00
Metadata cache created.
N|Solid Packages for Linux RPM based distros -   23 kB/s | 4.6 kB     00:00
Metadata cache created.
2025-02-25 17:43:24 - Repository is configured and updated.
2025-02-25 17:43:24 - You can use N|solid Runtime as a node.js alternative
2025-02-25 17:43:24 - To install N|solid Runtime, run: dnf install nsolid -y
2025-02-25 17:43:24 - Run 'dnf install nodejs -y' to complete the installation.

Installing Node.js

Once the repository is added, install Node.js with:

dnf install -y nodejs

Output:

[root@vps ~]# dnf install -y nodejs
Last metadata expiration check: 0:00:12 ago on Tue 25 Feb 2025 05:43:24 PM UTC.
Dependencies resolved.
================================================================================
 Package    Arch       Version                      Repository             Size
================================================================================
Installing:
 nodejs     x86_64     2:20.18.3-1nodesource        nodesource-nodejs      36 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 36 M
Installed size: 105 M
Downloading Packages:
nodejs-20.18.3-1nodesource.x86_64.rpm            43 MB/s |  36 MB     00:00
--------------------------------------------------------------------------------
Total                                            42 MB/s |  36 MB     00:00
Node.js Packages for Linux RPM based distros -   83 kB/s | 3.1 kB     00:00
Importing GPG key 0x3AF28A14:
 Userid     : "Nodesource Operations <operations@nodesource.com>"
 Fingerprint: 242B 8138 31AF 0956 2B6C 46F7 6B88 DA4E 3AF2 8A14
 From       : https://rpm.nodesource.com/gpgkey/ns-operations-public.key
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Running scriptlet: nodejs-2:20.18.3-1nodesource.x86_64                    1/1
  Installing       : nodejs-2:20.18.3-1nodesource.x86_64                    1/1
  Running scriptlet: nodejs-2:20.18.3-1nodesource.x86_64                    1/1

Installed:
  nodejs-2:20.18.3-1nodesource.x86_64

Complete!

Verifying the Installation

Check the installed Node.js version:

node -v

Output:

[root@vps ~]# node -v
v20.18.3

Check the npm version:

npm -v

Output

[root@vps ~]# npm -v
10.8.2

Conclusion

You have successfully installed Node.js 20 LTS on CentOS Stream 10 using the NodeSource repository. You can now start using Node.js for application development and package management with npm. 🚀


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS